Add more tests for satisfies (#13775)
This commit is contained in:
1 parent
931661a7aa
commit
67e121a20b
5 files changed
+67
-11
No files matched your search
+1
-1
@@ -31,7 +31,7 @@
|
||||
"dependencies": {
|
||||
"@angular/compiler": "14.2.8",
|
||||
"@babel/code-frame": "7.18.6",
|
||||
"@babel/parser": "7.20.0",
|
||||
"@babel/parser": "7.20.1",
|
||||
"@babel/types": "7.20.0",
|
||||
"@glimmer/syntax": "0.84.2",
|
||||
"@iarna/toml": "2.2.5",
|
||||
|
||||
@@ -272,11 +272,7 @@ function needsParens(path, options) {
|
||||
case "AssignmentPattern":
|
||||
return (
|
||||
key === "left" &&
|
||||
(node.type === "TSTypeAssertion" ||
|
||||
// babel-parser cannot parse `satisfies` operator in left side of assignment
|
||||
// https://github.com/babel/babel/issues/15095
|
||||
// TODO: Add tests after the bug is fixed
|
||||
isTSTypeExpression(node))
|
||||
(node.type === "TSTypeAssertion" || isTSTypeExpression(node))
|
||||
);
|
||||
|
||||
case "LogicalExpression":
|
||||
|
||||
@@ -576,6 +576,61 @@ window.postMessage({
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`lhs.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel-ts"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
(a satisfies number) = 42;
|
||||
({ a: (b satisfies any) = 2000 } = x);
|
||||
(this.selectorElem satisfies any) = this.multiselectWidget = this.initialValues = undefined;
|
||||
(this.configuration satisfies any) = (this.editor satisfies any) = (this
|
||||
.editorBody satisfies any) = undefined;
|
||||
|
||||
=====================================output=====================================
|
||||
;(a satisfies number) = 42
|
||||
;({ a: (b satisfies any) = 2000 } = x)
|
||||
;(this.selectorElem satisfies any) =
|
||||
this.multiselectWidget =
|
||||
this.initialValues =
|
||||
undefined
|
||||
;(this.configuration satisfies any) =
|
||||
(this.editor satisfies any) =
|
||||
(this.editorBody satisfies any) =
|
||||
undefined
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`lhs.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel-ts"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
(a satisfies number) = 42;
|
||||
({ a: (b satisfies any) = 2000 } = x);
|
||||
(this.selectorElem satisfies any) = this.multiselectWidget = this.initialValues = undefined;
|
||||
(this.configuration satisfies any) = (this.editor satisfies any) = (this
|
||||
.editorBody satisfies any) = undefined;
|
||||
|
||||
=====================================output=====================================
|
||||
(a satisfies number) = 42;
|
||||
({ a: (b satisfies any) = 2000 } = x);
|
||||
(this.selectorElem satisfies any) =
|
||||
this.multiselectWidget =
|
||||
this.initialValues =
|
||||
undefined;
|
||||
(this.configuration satisfies any) =
|
||||
(this.editor satisfies any) =
|
||||
(this.editorBody satisfies any) =
|
||||
undefined;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`nested-await-and-satisfies.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel-ts"]
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
(a satisfies number) = 42;
|
||||
({ a: (b satisfies any) = 2000 } = x);
|
||||
(this.selectorElem satisfies any) = this.multiselectWidget = this.initialValues = undefined;
|
||||
(this.configuration satisfies any) = (this.editor satisfies any) = (this
|
||||
.editorBody satisfies any) = undefined;
|
||||
@@ -228,12 +228,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@babel/parser@npm:7.20.0, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.18.10, @babel/parser@npm:^7.18.11":
|
||||
version: 7.20.0
|
||||
resolution: "@babel/parser@npm:7.20.0"
|
||||
"@babel/parser@npm:7.20.1, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.18.10, @babel/parser@npm:^7.18.11":
|
||||
version: 7.20.1
|
||||
resolution: "@babel/parser@npm:7.20.1"
|
||||
bin:
|
||||
parser: ./bin/babel-parser.js
|
||||
checksum: d54d68e45ff1b9a0c50a3f79d9031f482eb58f18928525949dc20da5b1658ee79167e756129371fd75d3e8fc7e218ab707727145a68958636be9672c7b71768e
|
||||
checksum: 2db7ba692b8b3054df129876b115ed8b265d5c138dee5e1db56a999209df3dd3d508e0985bf3cc44fc432498da094c164906b531d049608e55e208dae0678d42
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6612,7 +6612,7 @@ __metadata:
|
||||
"@angular/compiler": 14.2.8
|
||||
"@babel/code-frame": 7.18.6
|
||||
"@babel/generator": 7.20.0
|
||||
"@babel/parser": 7.20.0
|
||||
"@babel/parser": 7.20.1
|
||||
"@babel/types": 7.20.0
|
||||
"@esbuild-plugins/node-modules-polyfill": 0.1.4
|
||||
"@glimmer/reference": 0.84.2
|
||||
|
||||
Reference in new issue
Block a user