Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
SyrupThinker committed Jun 28, 2020
1 parent ffef89c commit bf4c9c0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cli/doc/tests.rs
Expand Up @@ -1605,3 +1605,24 @@ export namespace Deno {
let found = find_nodes_by_name_recursively(entries, "a.b.c".to_string());
assert_eq!(found.len(), 0);
}

mod printer_tests {
use super::*;

#[tokio::test]
async fn generic_instantiated_with_tuple_type() {
let source_code = r#"
interface Generic<T> {}
export function f(): Generic<[string, number]> { return {}; }
"#;

let loader =
TestLoader::new(vec![("test.ts".to_string(), source_code.to_string())]);
let entries = DocParser::new(loader).parse("test.ts").await.unwrap();

assert!(colors::strip_ansi_codes(
crate::doc::printer::format(entries).as_str()
)
.contains("Generic<[string, number]>"))
}
}

0 comments on commit bf4c9c0

Please sign in to comment.