HashStream.st
changeset 12174 e40625636dd5
parent 12146 cc757f348884
child 12273 96403b4aeb20
--- a/HashStream.st	Wed Oct 07 22:50:07 2009 +0200
+++ b/HashStream.st	Wed Oct 07 23:23:21 2009 +0200
@@ -78,6 +78,15 @@
     ^ self hashValueOf:aStringOrByteArrayOrStream
 ! !
 
+!HashStream class methodsFor:'queries'!
+
+canStream
+    "simple hash functions (squeak-ported) cannot stream.
+     Use hashFunction: there"
+
+    ^ true
+! !
+
 !HashStream class methodsFor:'self tests'!
 
 test
@@ -89,11 +98,14 @@
         data := pair first.
         expectedHash := pair second.
 
-        hashStream := self new.
-        hashStream nextPut:data.
-        hashStream hashValue ~= expectedHash ifTrue:[
-            self error:'Test failed'
+        self canStream ifTrue:[
+            hashStream := self new.
+            hashStream nextPut:data.
+            hashStream hashValue ~= expectedHash ifTrue:[
+                self error:'Test failed'
+            ].
         ].
+        "/ non-stream interface must be implemented by all
         (self hashValueOf:data) ~= expectedHash ifTrue:[
             self error:'Test failed'
         ].
@@ -302,9 +314,9 @@
 !HashStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.9 2009-10-05 11:14:49 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.10 2009-10-07 21:23:21 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.9 2009-10-05 11:14:49 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.10 2009-10-07 21:23:21 cg Exp $'
 ! !