-
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.
tests(typescript): Add e2e tests for comments
- Loading branch information
Showing
6 changed files
with
69 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod csharp; | ||
mod python; | ||
mod typescript; | ||
|
||
use std::{fs::read_to_string, path::Path}; | ||
|
||
|
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,22 @@ | ||
// This is a __T__single-line comment | ||
let singleLineComment: string = 'This uses a single-line__T__ comment'; | ||
|
||
/* | ||
This is a multi-line comment | ||
It can span multiple__T__ lines | ||
*/ | ||
let multiLineComment: string = 'This uses a multi-line__T__ comment'; | ||
|
||
/** | ||
* Adds two numbers.__T__ | ||
* @param a The first number. | ||
* @param b The second__T__ number. | ||
* @return The sum of a and b. | ||
*/ | ||
function add(a: number, b__T__: number): number { | ||
return a + b__T__; | ||
} | ||
|
||
console.log(singleLineComment); | ||
console.log(multiLineComment); | ||
console.log(`add(5, 3)__T__ = ${add(5, 3)}`); |
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,22 @@ | ||
use rstest::rstest; | ||
use srgn::scoping::langs::typescript::{PremadeTypeScriptQuery, TypeScript, TypeScriptQuery}; | ||
|
||
use super::{get_input_output, nuke_target}; | ||
|
||
#[rstest] | ||
#[case( | ||
"comments.ts", | ||
TypeScriptQuery::Premade(PremadeTypeScriptQuery::Comments) | ||
)] | ||
// #[case( | ||
// "strings.cs", | ||
// TypeScriptQuery::Premade(PremadeTypeScriptQuery::Strings) | ||
// )] | ||
fn test_typescript_nuke(#[case] file: &str, #[case] query: TypeScriptQuery) { | ||
let lang = TypeScript::new(query); | ||
|
||
let (input, output) = get_input_output("typescript", file); | ||
let result = nuke_target(&input, &lang); | ||
|
||
assert_eq!(result, output); | ||
} |
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,22 @@ | ||
// This is a single-line comment | ||
let singleLineComment: string = 'This uses a single-line__T__ comment'; | ||
|
||
/* | ||
This is a multi-line comment | ||
It can span multiple lines | ||
*/ | ||
let multiLineComment: string = 'This uses a multi-line__T__ comment'; | ||
|
||
/** | ||
* Adds two numbers. | ||
* @param a The first number. | ||
* @param b The second number. | ||
* @return The sum of a and b. | ||
*/ | ||
function add(a: number, b__T__: number): number { | ||
return a + b__T__; | ||
} | ||
|
||
console.log(singleLineComment); | ||
console.log(multiLineComment); | ||
console.log(`add(5, 3)__T__ = ${add(5, 3)}`); |