* Test for stringtoidentifier

This commit is contained in:
Michaël Van Canneyt 2022-04-02 10:14:36 +02:00
parent aedb6dbacd
commit 14c4a6796b

View File

@ -123,9 +123,27 @@ type
Procedure TestUNICODERANGE;
end;
{ TCSSTreeOtherTest }
TCSSTreeOtherTest = Class(TBaseCSSTreeTest)
Published
Procedure TestStringToIdentifier;
end;
implementation
{ TCSSTreeOtherTest }
procedure TCSSTreeOtherTest.TestStringToIdentifier;
begin
AssertEquals('Normal','abc',StringToIdentifier('abc'));
AssertEquals('dash','-abc',StringToIdentifier('-abc'));
AssertEquals('dashdash','--abc',StringToIdentifier('--abc'));
AssertEquals('Underscore','abc_d',StringToIdentifier('abc_d'));
AssertEquals('Numerical','abc_1',StringToIdentifier('abc_1'));
AssertEquals('Weird','abc\(1\)',StringToIdentifier('abc(1)'));
end;
{ TCSSTreeVisitorTest }
procedure TCSSTreeVisitorTest.Setup;
@ -787,6 +805,6 @@ begin
end;
initialization
RegisterTests([TCSSTreeTypeTest,TCSSTreeAsStringTest,TCSSTreeVisitorTest]);
RegisterTests([TCSSTreeTypeTest,TCSSTreeAsStringTest,TCSSTreeVisitorTest,TCSSTreeOtherTest]);
end.