Skip to content

Commit c7f14a2

Browse files
committed
Fix syntax error for 0.13.x version of purs
In 0.13.0, the parser was changed so it wouldn't allow strings with invalid Unicode. `\ffff` is now a syntax error. To get around this issue, we move it to the FFI. This isn't the only way to fix this problem, but it should still allow the same behavior of the test without changing the spirit of the test. If there's a different way to solve this problem that we'd prefer, we should do that instead.
1 parent ca4d80f commit c7f14a2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

test/Test/Main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ exports.thisIsNumber = 12;
66
exports.thisIsString = "foobar";
77
exports.thisIsArray = ["foo", "bar"];
88
exports.thisIsObject = { foo: "bar" };
9+
exports.thisIsInvalidString = "\\\ffff";

test/Test/Main.purs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ foreign import thisIsNumber :: Json
2323
foreign import thisIsString :: Json
2424
foreign import thisIsArray :: Json
2525
foreign import thisIsObject :: Json
26+
foreign import thisIsInvalidString :: String
2627

2728
isTest :: Effect Unit
2829
isTest = do
@@ -120,7 +121,7 @@ toTest = do
120121

121122
parserTest :: Effect Unit
122123
parserTest = do
123-
assert ((isLeft (jsonParser "\\\ffff")) <?> "Error in jsonParser")
124+
assert ((isLeft (jsonParser thisIsInvalidString)) <?> "Error in jsonParser")
124125
quickCheck' 10 roundtripTest
125126
where
126127
roundtripTest :: Gen Result

0 commit comments

Comments
 (0)