-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29511db
commit de94ed5
Showing
4 changed files
with
159 additions
and
7 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
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
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,124 @@ | ||
import {connect, disconnect, rewriteRun, rewriteRunWithOptions, typeScript} from '../testHarness'; | ||
|
||
describe('function mapping', () => { | ||
beforeAll(() => connect()); | ||
afterAll(() => disconnect()); | ||
|
||
test('simple', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
class Handler { | ||
test() { | ||
// hello world comment | ||
} | ||
} | ||
`) | ||
); | ||
}); | ||
|
||
|
||
test('single parameter', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
class Handler { | ||
test(input) { | ||
// hello world comment | ||
} | ||
} | ||
`) | ||
); | ||
}); | ||
|
||
test('single typed parameter', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
class Handler { | ||
test(input: string) { | ||
// hello world comment | ||
} | ||
} | ||
`) | ||
); | ||
}); | ||
|
||
test('single typed parameter with initializer', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
class Handler { | ||
test(input /*asda*/: string = /*8asdas */ "hello world" ) { | ||
// hello world comment | ||
} | ||
} | ||
`) | ||
); | ||
}); | ||
|
||
test('single parameter with initializer', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
class Handler { | ||
test(input = 1) { | ||
// hello world comment | ||
} | ||
} | ||
`) | ||
); | ||
}); | ||
|
||
test('multi parameters', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
class Handler { | ||
test(input: string, a = 1, test: number) { | ||
// hello world comment | ||
} | ||
} | ||
`) | ||
); | ||
}); | ||
|
||
test('parameter with trailing comma', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
class Handler { | ||
test(input: string , ) { | ||
// hello world comment | ||
} | ||
} | ||
`) | ||
); | ||
}); | ||
|
||
test('type parameters', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
class Handler { | ||
test<T>(input: T , ) { | ||
// hello world comment | ||
} | ||
} | ||
`) | ||
); | ||
}); | ||
|
||
test('multiple type parameters', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
class Handler { | ||
test<T>(input: T , ) { | ||
// hello world comment | ||
} | ||
} | ||
`) | ||
); | ||
}); | ||
}); |
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