Skip to content

Commit

Permalink
Add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jan 10, 2021
1 parent 91d2364 commit 13c6fbc
Show file tree
Hide file tree
Showing 16 changed files with 2,869 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -36,7 +36,7 @@
"dependencies": {
"eslint-visitor-keys": "^1.3.0",
"yaml": "^1.10.0",
"yaml-unist-parser": "^1.2.1"
"yaml-unist-parser": "^1.3.1"
},
"devDependencies": {
"@ota-meshi/eslint-plugin": "^0.0.6",
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/parser/ast/merge02-input.yaml
@@ -0,0 +1,2 @@
<<:
a: b" 1
268 changes: 268 additions & 0 deletions tests/fixtures/parser/ast/merge02-output.json
@@ -0,0 +1,268 @@
{
"type": "Program",
"body": [
{
"type": "YAMLDocument",
"directives": [],
"content": {
"type": "YAMLMapping",
"style": "block",
"pairs": [
{
"type": "YAMLPair",
"key": {
"type": "YAMLScalar",
"style": "plain",
"strValue": "<<",
"value": "<<",
"raw": "<<",
"range": [
0,
2
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 2
}
}
},
"value": {
"type": "YAMLMapping",
"style": "block",
"pairs": [
{
"type": "YAMLPair",
"key": {
"type": "YAMLScalar",
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
6,
7
],
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 3
}
}
},
"value": {
"type": "YAMLScalar",
"style": "plain",
"strValue": "b\" 1",
"value": "b\" 1",
"raw": "b\" 1",
"range": [
9,
13
],
"loc": {
"start": {
"line": 2,
"column": 5
},
"end": {
"line": 2,
"column": 9
}
}
},
"range": [
6,
13
],
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 9
}
}
}
],
"range": [
6,
13
],
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 9
}
}
},
"range": [
0,
13
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 9
}
}
}
],
"range": [
0,
13
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 9
}
}
},
"range": [
0,
14
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 0
}
}
}
],
"comments": [],
"sourceType": "module",
"tokens": [
{
"type": "Identifier",
"value": "<<",
"range": [
0,
2
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 2
}
}
},
{
"type": "Punctuator",
"value": ":",
"range": [
2,
3
],
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 3
}
}
},
{
"type": "Identifier",
"value": "a",
"range": [
6,
7
],
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 3
}
}
},
{
"type": "Punctuator",
"value": ":",
"range": [
7,
8
],
"loc": {
"start": {
"line": 2,
"column": 3
},
"end": {
"line": 2,
"column": 4
}
}
},
{
"type": "Identifier",
"value": "b\" 1",
"range": [
9,
13
],
"loc": {
"start": {
"line": 2,
"column": 5
},
"end": {
"line": 2,
"column": 9
}
}
}
],
"range": [
0,
14
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 0
}
}
}
5 changes: 5 additions & 0 deletions tests/fixtures/parser/ast/merge02-value.json
@@ -0,0 +1,5 @@
{
"<<": {
"a": "b\" 1"
}
}
6 changes: 6 additions & 0 deletions tests/fixtures/parser/ast/pair-in-block-map01-input.yaml
@@ -0,0 +1,6 @@
a : b
? c
: d
? e
?
: f

0 comments on commit 13c6fbc

Please sign in to comment.