add utils functions

This commit is contained in:
2018-10-28 19:21:06 +02:00
parent 23b4341d2e
commit dfd4a5e4bd
2 changed files with 35 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ uses
DUnitX.TestFramework,
System.Classes,
WinAPI.Windows,
SysUtils,
AG.PascalTokenizer;
type
@@ -15,6 +16,10 @@ type
// Simple single Test
[Test]
procedure Test1;
[Test]
procedure Test2;
[Test]
procedure Test3;
// Test with TestCase Atribute to supply parameters.
end;
@@ -38,6 +43,33 @@ begin
//sleep(10000);
end;
procedure TMyTestObject.Test2;
var
s:string;
begin
s:=#39'kek'#39;
if not is_string(s) then
raise Exception.Create('Is string error 1');
s:='s:=12334;';
if is_string(s) then
raise Exception.Create('Is string error 2');
end;
procedure TMyTestObject.Test3;
var
s:string;
begin
s:='{ asdasdasd }';
if not is_comment(s) then
raise Exception.Create('Is comment error 1');
s:='(* s:=12334;*)';
if not is_comment(s) then
raise Exception.Create('Is comment error 2');
s:='// s:=12334;*)';
if not is_comment(s) then
raise Exception.Create('Is comment error 3');
end;
initialization
TDUnitX.RegisterTestFixture(TMyTestObject);
end.