io.files: Ensure that slices can be written to utf8/utf16/ascii streams.

locals-and-roots
Doug Coleman 2016-04-07 12:42:52 -07:00
parent 6d417f4f71
commit 2f4f0da10d
1 changed files with 25 additions and 3 deletions

View File

@ -1,9 +1,10 @@
USING: alien alien.c-types alien.data arrays classes.struct
compiler.units continuations destructors fry generic.single io
io.directories io.encodings.8-bit.latin1 io.encodings.ascii
io.encodings.binary io.encodings.string io.files
io.files.private io.pathnames kernel locals make math sequences
specialized-arrays system threads tools.test vocabs ;
io.encodings.binary io.encodings.string io.encodings.utf16
io.encodings.utf8 io.files io.files.private io.pathnames kernel
locals make math sequences specialized-arrays system threads
tools.test vocabs ;
FROM: specialized-arrays.private => specialized-array-vocab ;
IN: io.files.tests
@ -270,3 +271,24 @@ CONSTANT: pt-array-1
[ cwd = ] [ cd ] [ cwd = ] tri
] cwd '[ _ dup cd cwd = ] [ ] cleanup
] unit-test
{ t } [
[
[ 0 1 "å" <slice> swap utf8 set-file-contents ]
[ utf8 file-contents ] bi "å" =
] with-test-file
] unit-test
{ t } [
[
[ 0 1 "å" <slice> swap utf16 set-file-contents ]
[ utf16 file-contents ] bi "å" =
] with-test-file
] unit-test
{ t } [
[
[ 0 1 "a" <slice> swap ascii set-file-contents ]
[ ascii file-contents ] bi "a" =
] with-test-file
] unit-test