Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for YAML #758

Merged
merged 1 commit into from
Sep 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/languages/yaml/boolean_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
foo: true
bar: false

----------------------------------------------------

[
["punctuation", "---"],
["key", "foo"], ["punctuation", ":"],
["boolean", "true"],
["key", "bar"], ["punctuation", ":"],
["boolean", "false"]
]

----------------------------------------------------

Checks for booleans.
13 changes: 13 additions & 0 deletions tests/languages/yaml/comment_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# foobar

----------------------------------------------------

[
["comment", "#"],
["comment", "# foobar"]
]

----------------------------------------------------

Checks for comments.
31 changes: 31 additions & 0 deletions tests/languages/yaml/datetime_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
canonical: 2001-12-15T02:59:43.1Z
iso8601: 2001-12-14t21:59:43.10-05:00
spaced: 2001-12-14 21:59:43.10 -5
date: 2002-12-14
times:
- 10:53
- 10:53:20.53

----------------------------------------------------

[
["punctuation", "---"],
["key", "canonical"], ["punctuation", ":"],
["datetime", "2001-12-15T02:59:43.1Z"],
["key", "iso8601"], ["punctuation", ":"],
["datetime", "2001-12-14t21:59:43.10-05:00"],
["key", "spaced"], ["punctuation", ":"],
["datetime", "2001-12-14 21:59:43.10 -5"],
["key", "date"], ["punctuation", ":"],
["datetime", "2002-12-14"],
["key", "times"], ["punctuation", ":"],
["punctuation", "-"],
["datetime", "10:53"],
["punctuation", "-"],
["datetime", "10:53:20.53"]
]

----------------------------------------------------

Checks for dates, times and datetimes.
13 changes: 13 additions & 0 deletions tests/languages/yaml/directive_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
%YAML 1.2
%TAG

----------------------------------------------------

[
["directive", "%YAML 1.2"],
["directive", "%TAG"]
]

----------------------------------------------------

Checks for directives.
19 changes: 19 additions & 0 deletions tests/languages/yaml/important_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
&B1
&A
*A
&SS
*SS

----------------------------------------------------

[
["important", "&B1"],
["important", "&A"],
["important", "*A"],
["important", "&SS"],
["important", "*SS"]
]

----------------------------------------------------

Checks for important.
15 changes: 15 additions & 0 deletions tests/languages/yaml/key_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
foo: 4
FooBar : 5

----------------------------------------------------

[
["punctuation", "---"],
["key", "foo"], ["punctuation", ":"], ["number", "4"],
["key", "FooBar"], ["punctuation", ":"], ["number", "5"]
]

----------------------------------------------------

Checks for keys.
17 changes: 17 additions & 0 deletions tests/languages/yaml/null_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
foo: null
bar: ~

----------------------------------------------------

[
["punctuation", "---"],
["key", "foo"], ["punctuation", ":"],
["null", "null"],
["key", "bar"], ["punctuation", ":"],
["null", "~"]
]

----------------------------------------------------

Checks for null and ~.
38 changes: 38 additions & 0 deletions tests/languages/yaml/number_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
foo: 0xBadFace
bar: 0o754
baz: 42
foo: 3.14159
bar: 4e8
baz: 3.1E-7
foo: 0.4e+2
bar: -0xFF
baz: +0o123

----------------------------------------------------

[
["punctuation", "---"],
["key", "foo"], ["punctuation", ":"],
["number", "0xBadFace"],
["key", "bar"], ["punctuation", ":"],
["number", "0o754"],
["key", "baz"], ["punctuation", ":"],
["number", "42"],
["key", "foo"], ["punctuation", ":"],
["number", "3.14159"],
["key", "bar"], ["punctuation", ":"],
["number", "4e8"],
["key", "baz"], ["punctuation", ":"],
["number", "3.1E-7"],
["key", "foo"], ["punctuation", ":"],
["number", "0.4e+2"],
["key", "bar"], ["punctuation", ":"],
["number", "-0xFF"],
["key", "baz"], ["punctuation", ":"],
["number", "+0o123"]
]

----------------------------------------------------

Checks for numbers.
23 changes: 23 additions & 0 deletions tests/languages/yaml/scalar_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
foo: >
Foo bar
baz
bar: |
Foo bar
baz

----------------------------------------------------

[
["punctuation", "---"],
["key", "foo"], ["punctuation", ":"],
["punctuation", ">"],
["scalar", "\r\n\tFoo bar\r\n\tbaz"],
["key", "bar"], ["punctuation", ":"],
["punctuation", "|"],
["scalar", "\r\n\tFoo bar\r\n\tbaz"]
]

----------------------------------------------------

Checks for scalars.
23 changes: 23 additions & 0 deletions tests/languages/yaml/string_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
foo: ""
bar: "fo\"obar"
foo: ''
bar: 'fo\'obar'

----------------------------------------------------

[
["punctuation", "---"],
["key", "foo"], ["punctuation", ":"],
["string", "\"\""],
["key", "bar"], ["punctuation", ":"],
["string", "\"fo\\\"obar\""],
["key", "foo"], ["punctuation", ":"],
["string", "''"],
["key", "bar"], ["punctuation", ":"],
["string", "'fo\\'obar'"]
]

----------------------------------------------------

Checks for strings.
15 changes: 15 additions & 0 deletions tests/languages/yaml/tag_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!!map
!!str
!!seq

----------------------------------------------------

[
["tag", "!!map"],
["tag", "!!str"],
["tag", "!!seq"]
]

----------------------------------------------------

Checks for tags