Browse Source

+ test for #14236 so it won't popup again

git-svn-id: trunk@13521 -
florian 16 years ago
parent
commit
e9b5bcc155
2 changed files with 44 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 43 0
      tests/webtbs/tw14236.pp

+ 1 - 0
.gitattributes

@@ -9231,6 +9231,7 @@ tests/webtbs/tw14149.pp svneol=native#text/plain
 tests/webtbs/tw14155.pp svneol=native#text/plain
 tests/webtbs/tw1416.pp svneol=native#text/plain
 tests/webtbs/tw14174.pp svneol=native#text/plain
+tests/webtbs/tw14236.pp svneol=native#text/plain
 tests/webtbs/tw1430.pp svneol=native#text/plain
 tests/webtbs/tw14307.pp svneol=native#text/plain
 tests/webtbs/tw1433.pp svneol=native#text/plain

+ 43 - 0
tests/webtbs/tw14236.pp

@@ -0,0 +1,43 @@
+
+program project1;
+// Run the following to cause an access violation
+//
+// ./project1 'as.*0' 'ascii_lf1'
+//
+
+{$mode objfpc}{$H+}
+
+uses
+  regex,
+  SysUtils;
+
+var
+  re : TRegexEngine;
+  aErrorPos : integer;
+  aErrorCode: TRegexError;
+  MatchPos : integer;
+  Offset : integer;
+  s1,s2 : string;
+begin
+  s1:='as.*0';
+  s2:='ascii_lf1';
+  try
+    WriteLn('Regex: Trim(s1) = >>'+Trim(s1)+'<<');
+    WriteLn('Test: Trim(s2) = >>'+Trim(s2)+'<<');
+    re := TRegexEngine.Create(Trim(s1));
+    if re.Parse(aErrorPos,aErrorCode) then begin
+      Offset := 1;
+      if re.MatchString(s2,MatchPos,Offset) then begin
+        WriteLn('Match');
+      end else begin
+        WriteLn('No Match');
+      end;
+    end else begin
+      WriteLn('Parse Failed');
+    end;
+  except
+    on E : Exception do begin
+      WriteLn('Exception: '+E.Message);
+    end;
+  end;
+end.