Skip to content

Commit

Permalink
Fix matching zero-length strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Moderocky committed Mar 9, 2022
1 parent dfc64e2 commit dc4a907
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ else if (escape) {

@Override
public Pattern.Match match(String thing, Context context) {
if (thing.length() < 2) return null;
if (thing.charAt(0) != '"') return null;
if (thing.charAt(thing.length() - 1) != '"') return null;
final String contents = thing.substring(1, thing.length() - 1);
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/maths.bsk
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ function basic:
assert {d} is 4: "Multiplication failed."
assert {e} is 2: "Square root (syntax) failed."
assert "hello " + "there" is "hello there": "String joining failed."
assert "Hello " + "<there!" is "Hello <there!": "String joining failed."

0 comments on commit dc4a907

Please sign in to comment.