Skip to content

Commit

Permalink
Adds more unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwanders committed Nov 19, 2020
1 parent 1ad358d commit eb37e45
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions spec/lib_lyaml_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ specify lyaml:
- context sequences:
- it writes a sequence:
expect (lyaml.dump {{1, 2, 3}}).to_contain "- 1\n- 2\n- 3"
- it writes a sequence containing nils: |
expect (lyaml.dump {{1, 2, nil, 3, 4}}).
to_contain.all_of {"1: 1", "2: 2", "4: 3", "5: 4"}

- context mappings:
- it writes a mapping: |
Expand All @@ -61,9 +58,18 @@ specify lyaml:
- it writes a mapping of mixed keys: |
expect (lyaml.dump {{[1]=1, [2]=2, three="three", four="4", [5]="five"}}).
to_contain.all_of {"1: 1", "2: 2", "three: three", "four: '4'", "5: five"}
- it writes a mapping of integer keys: |
expect (lyaml.dump {{[2]=2, [3]=3, [4]=4, five=5}}).
to_contain.all_of {"2: 2", "3: 3", "4: 4", "five: 5"}
- it writes a mapping of integer keys starting at two: |
expect (lyaml.dump {{[2]=2, [3]=3, [4]=4}}).
to_contain.all_of {"2: 2", "3: 3", "4: 4"}
- it writes a mapping of mixed keys starting at one: |
expect (lyaml.dump {{[1]=1, [2]=2, [3]=3, foo="bar"}}).
to_contain.all_of {"1: 1", "2: 2", "3: 3", "foo: bar"}
- it writes a mapping of mixed keys starting at two: |
expect (lyaml.dump {{[2]=2, [3]=3, [4]=4, foo="bar"}}).
to_contain.all_of {"2: 2", "3: 3", "4: 4", "foo: bar"}
- it writes a table containing nils (jumps in index) as mapping: |
expect (lyaml.dump {{1, 2, nil, 3, 4}}).
to_contain.all_of {"1: 1", "2: 2", "4: 3", "5: 4"}
- context anchors and aliases:
- before:
Expand Down

0 comments on commit eb37e45

Please sign in to comment.