summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Fusik <piotr@fusion-lang.org>2024-02-15 20:46:32 +0100
committerPiotr Fusik <piotr@fusion-lang.org>2024-02-15 20:46:32 +0100
commit853653d1acc59ae1179af723bd7637a7a0920dd0 (patch)
tree72b22e1ee9ce0844bc53a76181ca6b0cbed1866c
parent1d93e444ff1e0190b32f2f15ee90d330088a0241 (diff)
[test] C leaks from Match().
-rw-r--r--test/RegexMatch.fu13
-rw-r--r--test/RegexMatchReuse.fu4
2 files changed, 8 insertions, 9 deletions
diff --git a/test/RegexMatch.fu b/test/RegexMatch.fu
index 14c3215..4637f6b 100644
--- a/test/RegexMatch.fu
+++ b/test/RegexMatch.fu
@@ -6,17 +6,16 @@ public class Test
string() s = "The quick brown fox jumps over the lazy dog"; //FAIL: cl
if (!m.Find(s, "(B.+?) (\\wo\\w)", RegexOptions.IgnoreCase)) //FAIL: swift TODO
return false;
- if (m.Start != 10
- || m.End != 19 || m.End * 2 != 38
- || m.Length != 9 || m.Length * 2 != 18
- || m.Value != "brown fox"
- || m.GetCapture(1) != "brown" || m.GetCapture(2) != "fox")
- return false;
Match() m2;
string p = "The quick brown fox jumps over the lazy dog";
if (!m2.Find(p, "(B.+?) (\\wo\\w)", RegexOptions.IgnoreCase))
return false;
- return m2.Start == 10
+ return m.Start == 10
+ && m.End == 19 && m.End * 2 == 38
+ && m.Length == 9 && m.Length * 2 == 18
+ && m.Value == "brown fox"
+ && m.GetCapture(1) == "brown" && m.GetCapture(2) == "fox"
+ && m2.Start == 10
&& m2.End == 19 && m2.End * 2 == 38
&& m2.Length == 9 && m2.Length * 2 == 18
&& m2.Value == "brown fox"
diff --git a/test/RegexMatchReuse.fu b/test/RegexMatchReuse.fu
index b2f92d5..eedb23f 100644
--- a/test/RegexMatchReuse.fu
+++ b/test/RegexMatchReuse.fu
@@ -6,10 +6,10 @@ public class Test
string() s = "foo bar"; //FAIL: cl
if (!m.Find(s, "\\w{3}")) //FAIL: swift TODO
return false;
- if (m.Start != 0)
+ if (m.Value != "foo") //FAIL: c leak TODO
return false;
if (!m.Find(s, "b\\w\\w")) //FAIL: c leak TODO
return false;
- return m.Start == 4;
+ return m.Value == "bar";
}
}