Skip to content

Commit

Permalink
Fix syntax error for 0.13.x version of purs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joneshf committed Aug 25, 2019
1 parent ca4d80f commit c7f14a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/Test/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ exports.thisIsNumber = 12;
exports.thisIsString = "foobar";
exports.thisIsArray = ["foo", "bar"];
exports.thisIsObject = { foo: "bar" };
exports.thisIsInvalidString = "\\\ffff";
3 changes: 2 additions & 1 deletion test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ foreign import thisIsNumber :: Json
foreign import thisIsString :: Json
foreign import thisIsArray :: Json
foreign import thisIsObject :: Json
foreign import thisIsInvalidString :: String

isTest :: Effect Unit
isTest = do
Expand Down Expand Up @@ -120,7 +121,7 @@ toTest = do

parserTest :: Effect Unit
parserTest = do
assert ((isLeft (jsonParser "\\\ffff")) <?> "Error in jsonParser")
assert ((isLeft (jsonParser thisIsInvalidString)) <?> "Error in jsonParser")
quickCheck' 10 roundtripTest
where
roundtripTest :: Gen Result
Expand Down

0 comments on commit c7f14a2

Please sign in to comment.