Passing the wrong type of sequence to M\ encoder write now throws an error

db4
Slava Pestov 2009-04-20 03:26:56 -05:00
parent ec72f33fcb
commit 0f26d02d41
3 changed files with 17 additions and 3 deletions

View File

@ -5,7 +5,7 @@ IN: io.files.unique.tests
[ 123 ] [
"core" ".test" [
[ [ 123 CHAR: a <repetition> ] dip ascii set-file-contents ]
[ [ 123 CHAR: a <string> ] dip ascii set-file-contents ]
[ file-info size>> ] bi
] cleanup-unique-file
] unit-test

View File

@ -130,7 +130,9 @@ M: encoder stream-element-type
M: encoder stream-write1
>encoder< encode-char ;
: encoder-write ( string stream encoding -- )
GENERIC# encoder-write 2 ( string stream encoding -- )
M: string encoder-write
[ encode-char ] 2curry each ;
M: encoder stream-write

View File

@ -1,7 +1,7 @@
USING: arrays debugger.threads destructors io io.directories
io.encodings.8-bit io.encodings.ascii io.encodings.binary
io.files io.files.private io.files.temp io.files.unique kernel
make math sequences system threads tools.test ;
make math sequences system threads tools.test generic.standard ;
IN: io.files.tests
\ exists? must-infer
@ -144,3 +144,15 @@ USE: debugger.threads
-10 seek-absolute seek-input
] with-file-reader
] must-fail
[
"non-string-error" unique-file ascii [
{ } write
] with-file-writer
] [ no-method? ] must-fail-with
[
"non-byte-array-error" unique-file binary [
"" write
] with-file-writer
] [ no-method? ] must-fail-with