Skip to content

Commit

Permalink
test: Add comment syntax test (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
3w36zj6 authored Apr 2, 2024
1 parent e05c44e commit f9e3e2e
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/fixtures/mdxFlowExpressionComment/input.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{/* comment */}

{ /* comment */ }

{
/* comment */
}
65 changes: 65 additions & 0 deletions test/fixtures/mdxFlowExpressionComment/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"type": "Document",
"children": [
{
"type": "Comment",
"value": " comment ",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"range": [0, 15],
"raw": "{/* comment */}"
},
{
"type": "CodeBlock",
"value": " /* comment */ ",
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 17
}
},
"range": [17, 34],
"raw": "{ /* comment */ }"
},
{
"type": "CodeBlock",
"value": "\n/* comment */\n",
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 7,
"column": 1
}
},
"range": [36, 53],
"raw": "{\n/* comment */\n}"
}
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 8,
"column": 0
}
},
"range": [0, 54],
"raw": "{/* comment */}\n\n{ /* comment */ }\n\n{\n/* comment */\n}\n"
}
3 changes: 3 additions & 0 deletions test/fixtures/mdxTextExpressionComment/input.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a {/*comment*/} b

a { /*comment*/ } b
147 changes: 147 additions & 0 deletions test/fixtures/mdxTextExpressionComment/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"type": "Document",
"children": [
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"value": "a ",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 2
}
},
"range": [0, 2],
"raw": "a "
},
{
"type": "Comment",
"value": "comment",
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 15
}
},
"range": [2, 15],
"raw": "{/*comment*/}"
},
{
"type": "Str",
"value": " b",
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 17
}
},
"range": [15, 17],
"raw": " b"
}
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"range": [0, 17],
"raw": "a {/*comment*/} b"
},
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"value": "a ",
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 2
}
},
"range": [19, 21],
"raw": "a "
},
{
"type": "Code",
"value": " /*comment*/ ",
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 17
}
},
"range": [21, 36],
"raw": "{ /*comment*/ }"
},
{
"type": "Str",
"value": " b",
"loc": {
"start": {
"line": 3,
"column": 17
},
"end": {
"line": 3,
"column": 19
}
},
"range": [36, 38],
"raw": " b"
}
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 19
}
},
"range": [19, 38],
"raw": "a { /*comment*/ } b"
}
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 0
}
},
"range": [0, 39],
"raw": "a {/*comment*/} b\n\na { /*comment*/ } b\n"
}

0 comments on commit f9e3e2e

Please sign in to comment.