Browse Source

* Test for stringtoidentifier

Michaël Van Canneyt 3 years ago
parent
commit
14c4a6796b
1 changed files with 19 additions and 1 deletions
  1. 19 1
      packages/fcl-css/tests/tccsstree.pp

+ 19 - 1
packages/fcl-css/tests/tccsstree.pp

@@ -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.