Skip to content

Commit

Permalink
Make tests pPrettier
Browse files Browse the repository at this point in the history
  • Loading branch information
otakubeam committed Jul 8, 2023
1 parent 3ebc598 commit 530062f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/dasPEG/tests/calc.das
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ def test_calc(t: T?)
let input = "1+2*2+1---(3*2+1*2)-1-1-1*2"
var parser <- get_parser_with(input)
var res <- parser |> parse_add
t |> equal(-6, res.value)
t |> equal(-6, res.value)
16 changes: 13 additions & 3 deletions modules/dasPEG/tests/json.das
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,35 @@ def get_parser_with(input: string): jsonParser
[test]
def test1(t: T?)
let input = "[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]"

var parser <- get_parser_with(input)
var res_json <- parse_JsonValue(parser).value

var discard_error: string
var json <- read_json(input, discard_error)
t |> equal(json, parse_JsonValue(parser).value)

t |> equal(json |> write_json(), res_json |> write_json)


[test]
def test2(t: T?)
let input = "\{\"a\" : 123.53, \"b\": true \}"
var parser <- get_parser_with(input)
var res_json <- parse_JsonValue(parser).value

var discard_error: string
var json <- read_json(input, discard_error)
t |> equal(json, parse_JsonValue(parser).value)

t |> equal(json |> write_json(), res_json |> write_json)


[test]
def test3(t: T?)
let input = "[\"123\", true,[], \{\}, \{\"hello\" : true, \"less\": \"more\"\}, [[[true]]], \"123\"]"
var parser <- get_parser_with(input)
var res_json <- parse_JsonValue(parser).value

var discard_error: string
var json <- read_json(input, discard_error)
t |> equal(json, parse_JsonValue(parser).value)

t |> equal(json |> write_json(), res_json |> write_json)

0 comments on commit 530062f

Please sign in to comment.