This repository has been archived by the owner on May 19, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for ?? with other LogicalExpressions
- Loading branch information
Showing
15 changed files
with
411 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
test/fixtures/experimental/nullish-coalescing-operator/nullish-and/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a ?? b && c; |
132 changes: 132 additions & 0 deletions
132
test/fixtures/experimental/nullish-coalescing-operator/nullish-and/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 12, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 12, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12 | ||
} | ||
}, | ||
"sourceType": "script", | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 12, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12 | ||
} | ||
}, | ||
"expression": { | ||
"type": "LogicalExpression", | ||
"start": 0, | ||
"end": 11, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 11 | ||
} | ||
}, | ||
"left": { | ||
"type": "Identifier", | ||
"start": 0, | ||
"end": 1, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 1 | ||
}, | ||
"identifierName": "a" | ||
}, | ||
"name": "a" | ||
}, | ||
"operator": "??", | ||
"right": { | ||
"type": "LogicalExpression", | ||
"start": 5, | ||
"end": 11, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 11 | ||
} | ||
}, | ||
"left": { | ||
"type": "Identifier", | ||
"start": 5, | ||
"end": 6, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 6 | ||
}, | ||
"identifierName": "b" | ||
}, | ||
"name": "b" | ||
}, | ||
"operator": "&&", | ||
"right": { | ||
"type": "Identifier", | ||
"start": 10, | ||
"end": 11, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 10 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 11 | ||
}, | ||
"identifierName": "c" | ||
}, | ||
"name": "c" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": ["nullishCoalescingOperator"] | ||
} | ||
|
1 change: 1 addition & 0 deletions
1
test/fixtures/experimental/nullish-coalescing-operator/nullish-or/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a ?? b || c; |
132 changes: 132 additions & 0 deletions
132
test/fixtures/experimental/nullish-coalescing-operator/nullish-or/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 12, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 12, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12 | ||
} | ||
}, | ||
"sourceType": "script", | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 12, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12 | ||
} | ||
}, | ||
"expression": { | ||
"type": "LogicalExpression", | ||
"start": 0, | ||
"end": 11, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 11 | ||
} | ||
}, | ||
"left": { | ||
"type": "LogicalExpression", | ||
"start": 0, | ||
"end": 6, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 6 | ||
} | ||
}, | ||
"left": { | ||
"type": "Identifier", | ||
"start": 0, | ||
"end": 1, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 1 | ||
}, | ||
"identifierName": "a" | ||
}, | ||
"name": "a" | ||
}, | ||
"operator": "??", | ||
"right": { | ||
"type": "Identifier", | ||
"start": 5, | ||
"end": 6, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 6 | ||
}, | ||
"identifierName": "b" | ||
}, | ||
"name": "b" | ||
} | ||
}, | ||
"operator": "||", | ||
"right": { | ||
"type": "Identifier", | ||
"start": 10, | ||
"end": 11, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 10 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 11 | ||
}, | ||
"identifierName": "c" | ||
}, | ||
"name": "c" | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": ["nullishCoalescingOperator"] | ||
} | ||
|
1 change: 1 addition & 0 deletions
1
test/fixtures/experimental/nullish-coalescing-operator/or-nullish/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a || b ?? c; |
Oops, something went wrong.