Skip to content

Commit

Permalink
Fix equality definition between byte and Token (#151)
Browse files Browse the repository at this point in the history
* Fix equality definition between byte and Token

* Bump version
  • Loading branch information
nickrobinson251 committed Nov 15, 2022
1 parent 38615bb commit f994915
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Parsers"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
authors = ["quinnj <quinn.jacobd@gmail.com>"]
version = "2.5.0"
version = "2.5.1"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
1 change: 1 addition & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function ==(a::Token, b::Token)
end
end
==(a::Token, b::UInt8) = a.token isa UInt8 && a.token == b
==(a::UInt8, b::Token) = (b == a)
_contains(a::Token, str::String) = _contains(a.token, str)
_contains(a::UInt8, str::String) = a == UInt8(str[1])
_contains(a::Char, str::String) = a == str[1]
Expand Down
8 changes: 7 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ res = Parsers.xparse(Int64, "1\n"; sentinel=["", " ", " "])
@test res.tlen == 2
@test res.code == (OK | EOF | NEWLINE)

# #140, #142
# #140, #142
res = Parsers.xparse(String, "NA"; sentinel=["NA"])
@test res.code == (SENTINEL | EOF)

Expand Down Expand Up @@ -646,6 +646,12 @@ res = Parsers.xparse(String, source, 1 + res.tlen, 0, opt)
buf = UInt8[0x20, 0x20, 0x41, 0x20, 0x20, 0x42, 0x0a, 0x20, 0x20, 0x31, 0x20, 0x20, 0x32, 0x0a, 0x20, 0x20, 0x31, 0x31, 0x20, 0x32, 0x32]
@test Parsers.checkdelim!(buf, 1, 21, Parsers.Options(delim=' ', ignorerepeated=true)) == 3

# #150
@test 0x22 == Parsers.Token(0x22)
@test 0x22 != Parsers.Token(0x00)
@test Parsers.Token(0x22) == 0x22
@test Parsers.Token(0x22) != 0x00

end # @testset "misc"

include("floats.jl")
Expand Down

2 comments on commit f994915

@nickrobinson251
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/72275

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.5.1 -m "<description of version>" f994915670b41ea16b5e9907b8ebd2214e34ddab
git push origin v2.5.1

Please sign in to comment.