4
4
mktemp () do path, file
5
5
function append_to_file (str)
6
6
mark (file)
7
- println (file, str)
7
+ print (file, str)
8
8
flush (file)
9
9
reset (file)
10
10
end
11
11
12
12
# test it doesn't error on eof
13
- @test skipchars (file, isspace) == file
13
+ @test eof ( skipchars (file, isspace))
14
14
15
- # test if it correctly skips
15
+ # test it correctly skips
16
16
append_to_file (" " )
17
17
@test eof (skipchars (file, isspace))
18
18
@@ -22,12 +22,20 @@ mktemp() do path, file
22
22
23
23
# test it stops at the appropriate time
24
24
append_to_file (" not a space" )
25
- @test skipchars (file, isspace) == file
26
- @test ! eof (file) && read (file, Char) == ' n'
25
+ @test ! eof ( skipchars (file, isspace))
26
+ @test read (file, Char) == ' n'
27
27
28
28
# test it correctly ignores the contents of comment lines
29
29
append_to_file (" #not a space \n not a space" )
30
- @test skipchars (file, isspace, linecomment= ' #' ) == file
31
- @test ! eof (file) && read (file, Char) == ' n'
30
+ @test ! eof (skipchars (file, isspace, linecomment= ' #' ))
31
+ @test read (file, Char) == ' n'
32
+
33
+ # test it correctly handles unicode
34
+ for (byte,char) in zip (1 : 4 , (' @' ,' ߷' ,' ࿊' ,' 𐋺' ))
35
+ append_to_file (" abcdef$char " )
36
+ @test Base. codelen (char) == byte
37
+ @test ! eof (skipchars (file, isalpha))
38
+ @test read (file, Char) == char
39
+ end
32
40
end
33
41
0 commit comments