1
0
Fork 0
mirror of https://github.com/MillironX/XAM.jl.git synced 2024-12-23 21:28:18 +00:00

Workaround for #23

This commit is contained in:
Ciarán O'Mara 2020-07-20 12:49:56 +10:00
parent a51e91141f
commit da0c1881dd
2 changed files with 23 additions and 3 deletions

View file

@ -28,9 +28,16 @@ const sam_machine_metainfo, sam_machine_record, sam_machine_header, sam_machine_
key.actions[:enter] = [:pos2] key.actions[:enter] = [:pos2]
key.actions[:exit] = [:metainfo_dict_key] key.actions[:exit] = [:metainfo_dict_key]
val = re"[ -~]+" val = re"[ -~]+"
val.actions[:enter] = [:pos2]
val.actions[:exit] = [:metainfo_dict_val] # val.actions[:enter] = [:pos2]
keyval = cat(key, ':', val) # val.actions[:exit] = [:metainfo_dict_val]
# keyval = cat(key, ':', val)
separator = re":"
separator.actions[:exit] = [:pos2]
keyval = cat(key, separator, opt(val))
keyval.actions[:exit] = [:metainfo_dict_val]
cat(keyval, rep(cat('\t', keyval))) cat(keyval, rep(cat('\t', keyval)))
end end

View file

@ -30,6 +30,19 @@
@test metainfo["VN"] == "1.0" @test metainfo["VN"] == "1.0"
@test metainfo["SO"] == "coordinate" @test metainfo["SO"] == "coordinate"
@test_throws KeyError metainfo["GO"] @test_throws KeyError metainfo["GO"]
metainfo = SAM.MetaInfo("@PG ID:hisat2 PN:hisat2 VN: CL:\"/script.sh\"")
@test haskey(metainfo, "ID")
@test haskey(metainfo, "PN")
# @test haskey(metainfo, "VN")
@test haskey(metainfo, "CL")
@test metainfo["ID"] == "hisat2"
@test metainfo["PN"] == "hisat2"
# @test metainfo["VN"] == ""
@test metainfo["CL"] == "\"/script.sh\""
end end
@testset "Header" begin @testset "Header" begin