mirror of
https://github.com/bkaradzic/bx.git
synced 2026-10-23 01:01:06 +00:00
Scanner: Class::Identifier must not start with a digit. (#414)
This commit is contained in:
committed by
GitHub
parent
43bfe29402
commit
822be40688
@@ -144,6 +144,46 @@ TEST_CASE("Scanner.class accept", "[scanner]")
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Scanner.class Identifier start", "[scanner]")
|
||||
{
|
||||
{
|
||||
bx::Scanner sc(bx::StringView("123abc") );
|
||||
REQUIRE(sc.accept(bx::Scanner::Class::Identifier).isEmpty() );
|
||||
REQUIRE(sc.peek(bx::Scanner::Class::Identifier).isEmpty() );
|
||||
REQUIRE("123abc" == sc.acceptAll() );
|
||||
}
|
||||
|
||||
{
|
||||
bx::Scanner sc(bx::StringView("5_0") );
|
||||
REQUIRE(sc.accept(bx::Scanner::Class::Identifier).isEmpty() );
|
||||
}
|
||||
|
||||
{
|
||||
bx::Scanner sc(bx::StringView("abc123 def") );
|
||||
REQUIRE("abc123" == sc.accept(bx::Scanner::Class::Identifier) );
|
||||
}
|
||||
|
||||
{
|
||||
bx::Scanner sc(bx::StringView("_abc9") );
|
||||
REQUIRE("_abc9" == sc.accept(bx::Scanner::Class::Identifier) );
|
||||
}
|
||||
|
||||
{
|
||||
bx::Scanner sc(bx::StringView("ps_5_0") );
|
||||
REQUIRE("ps_5_0" == sc.accept(bx::Scanner::Class::Identifier) );
|
||||
}
|
||||
|
||||
{
|
||||
bx::Scanner sc(bx::StringView("-abc") );
|
||||
REQUIRE(sc.accept(bx::Scanner::Class::Identifier).isEmpty() );
|
||||
}
|
||||
|
||||
{
|
||||
bx::Scanner sc(bx::StringView("") );
|
||||
REQUIRE(sc.accept(bx::Scanner::Class::Identifier).isEmpty() );
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Scanner.peek", "[scanner]")
|
||||
{
|
||||
bx::Scanner sc(bx::StringView("abc def") );
|
||||
|
||||
Reference in New Issue
Block a user