@@ -33,12 +33,16 @@ let s = "a string チャネルパートナーの選択"
3333 p = StringEncoder (IOBuffer (), " UTF-16LE" )
3434 write (p, s. data)
3535 close (p)
36+ # Test that closed pipe behaves correctly
37+ @test_throws ArgumentError write (p, ' a' )
3638
3739 b = IOBuffer ()
3840 p = StringEncoder (b, " UTF-16LE" )
3941 @test string (p) == " StringEncoder{UTF-8, UTF-16LE}($(string (b)) )"
4042 write (p, s. data[1 : 10 ])
4143 @test_throws IncompleteSequenceError close (p)
44+ # Test that closed pipe behaves correctly even after an error
45+ @test_throws ArgumentError write (p, ' a' )
4246
4347 # This time, call show
4448 p = StringEncoder (IOBuffer (), " UTF-16LE" )
@@ -57,6 +61,9 @@ let s = "a string チャネルパートナーの選択"
5761 @test string (p) == " StringDecoder{UTF-16LE, UTF-8}($(string (b)) )"
5862 @test readstring (p) == s[1 : 9 ]
5963 @test_throws IncompleteSequenceError close (p)
64+ # Test that closed pipe behaves correctly even after an error
65+ @test eof (p)
66+ @test_throws ArgumentError read (p, UInt8)
6067
6168 # Test stateful encoding, which output some bytes on final reset
6269 # with strings containing different scripts
@@ -68,7 +75,7 @@ let s = "a string チャネルパートナーの選択"
6875 # Test that closed pipe behaves correctly
6976 close (p)
7077 @test eof (p)
71- @test_throws EOFError read (p, UInt8)
78+ @test_throws ArgumentError read (p, UInt8)
7279 close (p)
7380end
7481
0 commit comments