-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add various new testcases, some skipped
- Loading branch information
1 parent
11f6ce5
commit a73df3f
Showing
7 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
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,25 @@ | ||
export const input = ` | ||
for (var x of [1, 2, 3]) { | ||
for (var y of [4, 5, 6]) { | ||
print(x, y) | ||
} | ||
} | ||
` | ||
|
||
export const find = ` | ||
for (var $a of $b) $body | ||
` | ||
|
||
export const replace = ` | ||
for (const $a of $b) $body | ||
` | ||
|
||
export const expectedReplace = ` | ||
for (const x of [1, 2, 3]) { | ||
for (const y of [4, 5, 6]) { | ||
print(x, y) | ||
} | ||
} | ||
` | ||
|
||
export const skip = true |
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,25 @@ | ||
export const input = ` | ||
class Everything<A> extends Base<A, string> implements Foo<A>, Bar { | ||
} | ||
` | ||
|
||
export const find = ` | ||
class $A<$$B> extends $C<$$D> implements $$E { | ||
} | ||
` | ||
|
||
export const expectedFind = [ | ||
{ | ||
arrayCaptures: { | ||
$$B: ['A'], | ||
$$D: ['A', 'string'], | ||
$$E: ['Foo<A>', 'Bar'], | ||
}, | ||
captures: { | ||
$A: 'Everything', | ||
$C: 'Base', | ||
}, | ||
node: 'class Everything<A> extends Base<A, string> implements Foo<A>, Bar {\n}', | ||
}, | ||
] |
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,34 @@ | ||
export const input = ` | ||
function foo(thing) { | ||
thing.then(() => blah).finally(() => done) | ||
return thing.then( | ||
value => value * 2, | ||
error => logged(error) | ||
).catch(error => blah) | ||
} | ||
` | ||
|
||
export const find = ` | ||
$Or($a.then($handleValue), $a.then($handleValue, $handleError), $a.catch($handleError), $a.finally($handleFinally)) | ||
` | ||
|
||
export const expectedFind = [ | ||
{ | ||
arrayCaptures: { | ||
$$args: ['error => blah'], | ||
}, | ||
captures: { | ||
$a: 'thing.then(\n value => value * 2,\n error => logged(error)\n )', | ||
}, | ||
node: 'thing.then(\n value => value * 2,\n error => logged(error)\n ).catch(error => blah)', | ||
}, | ||
{ | ||
arrayCaptures: { | ||
$$args: ['value => value * 2', 'error => logged(error)'], | ||
}, | ||
captures: { | ||
$a: 'thing', | ||
}, | ||
node: 'thing.then(\n value => value * 2,\n error => logged(error)\n )', | ||
}, | ||
] |
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,25 @@ | ||
export const input = ` | ||
class Cls { | ||
} | ||
` | ||
|
||
export const find = ` | ||
class $A extends $Maybe<$C> { | ||
} | ||
` | ||
|
||
export const expectedFind = [ | ||
{ | ||
arrayCaptures: { | ||
$$B: ['A'], | ||
}, | ||
captures: { | ||
$A: 'Cls', | ||
$C: 'Base', | ||
}, | ||
node: 'class Cls<A> extends Base {\n}', | ||
}, | ||
] | ||
|
||
export const skip = true |
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,25 @@ | ||
export const input = ` | ||
class Cls<A> extends Base { | ||
} | ||
` | ||
|
||
export const find = ` | ||
class $A<$$B> extends $C<$Maybe<$D>> { | ||
} | ||
` | ||
|
||
export const expectedFind = [ | ||
{ | ||
arrayCaptures: { | ||
$$B: ['A'], | ||
}, | ||
captures: { | ||
$A: 'Cls', | ||
$C: 'Base', | ||
}, | ||
node: 'class Cls<A> extends Base {\n}', | ||
}, | ||
] | ||
|
||
export const skip = true |
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,15 @@ | ||
export const input = ` | ||
import App from 'next/app' | ||
` | ||
|
||
export const find = ` | ||
import $App from 'next/app' | ||
` | ||
|
||
export const replace = ` | ||
import { App as $App } from 'next' | ||
` | ||
|
||
export const expectedReplace = ` | ||
import { App } from 'next' | ||
` |
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,19 @@ | ||
export const input = ` | ||
var a = 1 | ||
var b: number = 2 | ||
var [c, d] = f | ||
` | ||
|
||
export const find = ` | ||
var $a = $b | ||
` | ||
|
||
export const replace = ` | ||
const $a = $b | ||
` | ||
|
||
export const expectedReplace = ` | ||
const a = 1 | ||
const b: number = 2 | ||
const [c, d] = f | ||
` |