|
84 | 84 |
|
85 | 85 | # Seek test. |
86 | 86 | open(Bag.file, "r") do io |
| 87 | + @info "" readline(io, keep = true) |
87 | 88 | seek(io, Record) |
88 | | - # @test position(io) == 536 #TOOD: determine why the returned position on windows machines is 545. |
| 89 | + @test position(io) == 536 || position(io) == 545 #TODO: determine why the returned position on windows machines is 545. |
89 | 90 | @test readline(io) == Bag.line1 |
90 | 91 | end |
91 | 92 |
|
@@ -286,26 +287,32 @@ end #testset Internal Helpers |
286 | 287 |
|
287 | 288 | @testset "NamedTuple" begin |
288 | 289 |
|
289 | | - record = Record(Bag.line1) |
| 290 | + # Check strictly named fields. |
290 | 291 |
|
291 | | - nt = ( |
292 | | - chrom = Bag.chroms[1], |
293 | | - first = Bag.firsts[1], |
294 | | - last = Bag.lasts[1], |
295 | | - value = Bag.values[1], |
| 292 | + nt_strict_names = ( |
| 293 | + chrom = Bag.record1.chrom, |
| 294 | + first=Bag.record1.first, |
| 295 | + last=Bag.record1.last, |
| 296 | + value=Bag.record1.value |
296 | 297 | ) |
297 | 298 |
|
298 | | - @test record == Record(nt) |
| 299 | + @test convert(NamedTuple{(:chrom, :first, :last, :value)}, Bag.record1) == convert(NamedTuple, Bag.record1) == nt_strict_names |
| 300 | + @test Bag.record1 == convert(Record, nt_strict_names) |
| 301 | + @test Bag.record1 == Record(nt_strict_names) |
299 | 302 |
|
300 | | - @test convert(NamedTuple{(:chrom, :first, :last, :value)}, record) == convert(NamedTuple, record) == nt |
| 303 | + # Check loosely named fields. |
301 | 304 |
|
302 | | - # Check renaming of fields. |
303 | | - @test convert(NamedTuple{(:chrom, :left, :right, :value)}, record) == ( |
304 | | - chrom = Bag.chroms[1], |
305 | | - left = Bag.firsts[1], |
306 | | - right = Bag.lasts[1], |
307 | | - value = Bag.values[1], |
| 305 | + nt_loose_names = ( |
| 306 | + chrom = Bag.record1.chrom, |
| 307 | + left=Bag.record1.first, |
| 308 | + right=Bag.record1.last, |
| 309 | + value=Bag.record1.value |
308 | 310 | ) |
| 311 | + |
| 312 | + @test convert(NamedTuple{(:chrom, :left, :right, :value)}, Bag.record1) == nt_loose_names |
| 313 | + @test Bag.record1 == convert(Record, nt_loose_names) |
| 314 | + @test Bag.record1 == Record(nt_loose_names) |
| 315 | + |
309 | 316 | end |
310 | 317 |
|
311 | 318 | end # total testset |
0 commit comments