22
33file = tempname ()
44write (file, " Hello World\n " )
5- t = " Hello World" . data
5+ t = b " Hello World"
66@test Mmap. mmap (file, Array{UInt8,3 }, (11 ,1 ,1 )) == reshape (t,(11 ,1 ,1 ))
77gc (); gc ()
88@test Mmap. mmap (file, Array{UInt8,3 }, (1 ,11 ,1 )) == reshape (t,(1 ,11 ,1 ))
@@ -16,7 +16,7 @@ gc(); gc()
1616gc (); gc ()
1717@test Mmap. mmap (file, Array{UInt8,2 }, (0 ,12 )) == Array {UInt8} ((0 ,0 ))
1818m = Mmap. mmap (file, Array{UInt8,3 }, (1 ,2 ,1 ))
19- @test m == reshape (" He" . data ,(1 ,2 ,1 ))
19+ @test m == reshape (b " He" ,(1 ,2 ,1 ))
2020finalize (m); m= nothing ; gc ()
2121
2222# constructors
@@ -49,7 +49,7 @@ s = open(f->f,file,"w")
4949@test Mmap. mmap (file) == Array {UInt8} (0 ) # requested len=0 on empty file
5050@test Mmap. mmap (file,Vector{UInt8},0 ) == Array {UInt8} (0 )
5151m = Mmap. mmap (file,Vector{UInt8},12 )
52- m[:] = " Hello World\n " . data
52+ m[:] = b " Hello World\n "
5353Mmap. sync! (m)
5454finalize (m); m= nothing ; gc ()
5555@test open (readstring,file) == " Hello World\n "
@@ -115,10 +115,10 @@ write(file, "Hello World\n")
115115s = open (file, " r" )
116116@test isreadonly (s) == true
117117c = Mmap. mmap (s, Vector{UInt8}, (11 ,))
118- @test c == " Hello World" . data
118+ @test c == b " Hello World"
119119finalize (c); c= nothing ; gc ()
120120c = Mmap. mmap (s, Vector{UInt8}, (UInt16 (11 ),))
121- @test c == " Hello World" . data
121+ @test c == b " Hello World"
122122finalize (c); c= nothing ; gc ()
123123@test_throws ArgumentError Mmap. mmap (s, Vector{UInt8}, (Int16 (- 11 ),))
124124@test_throws ArgumentError Mmap. mmap (s, Vector{UInt8}, (typemax (UInt),))
@@ -136,18 +136,18 @@ close(s)
136136finalize (c); c= nothing ; gc ()
137137
138138c = Mmap. mmap (file)
139- @test c == " Hellx World\n " . data
139+ @test c == b " Hellx World\n "
140140finalize (c); c= nothing ; gc ()
141141c = Mmap. mmap (file, Vector{UInt8}, 3 )
142- @test c == " Hel" . data
142+ @test c == b " Hel"
143143finalize (c); c= nothing ; gc ()
144144s = open (file, " r" )
145145c = Mmap. mmap (s, Vector{UInt8}, 6 )
146- @test c == " Hellx " . data
146+ @test c == b " Hellx "
147147close (s)
148148finalize (c); c= nothing ; gc ()
149149c = Mmap. mmap (file, Vector{UInt8}, 5 , 6 )
150- @test c == " World" . data
150+ @test c == b " World"
151151finalize (c); c= nothing ; gc ()
152152
153153s = open (file, " w" )
@@ -156,26 +156,26 @@ close(s)
156156
157157# test Mmap.mmap
158158m = Mmap. mmap (file)
159- t = " Hello World\n "
159+ tdata = b " Hello World\n "
160160for i = 1 : 12
161- @test m[i] == t . data [i]
161+ @test m[i] == tdata [i]
162162end
163163@test_throws BoundsError m[13 ]
164164finalize (m); m= nothing ; gc ()
165165
166166m = Mmap. mmap (file,Vector{UInt8},6 )
167- @test m[1 ] == " H" . data [1 ]
168- @test m[2 ] == " e" . data [1 ]
169- @test m[3 ] == " l" . data [1 ]
170- @test m[4 ] == " l" . data [1 ]
171- @test m[5 ] == " o" . data [1 ]
172- @test m[6 ] == " " . data [1 ]
167+ @test m[1 ] == b " H" [1 ]
168+ @test m[2 ] == b " e" [1 ]
169+ @test m[3 ] == b " l" [1 ]
170+ @test m[4 ] == b " l" [1 ]
171+ @test m[5 ] == b " o" [1 ]
172+ @test m[6 ] == b " " [1 ]
173173@test_throws BoundsError m[7 ]
174174finalize (m); m= nothing ; gc ()
175175
176176m = Mmap. mmap (file,Vector{UInt8},2 ,6 )
177- @test m[1 ] == " W" . data [1 ]
178- @test m[2 ] == " o" . data [1 ]
177+ @test m[1 ] == b " W" [1 ]
178+ @test m[2 ] == b " o" [1 ]
179179@test_throws BoundsError m[3 ]
180180finalize (m); m = nothing ; gc ()
181181
0 commit comments