diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/repl_tests.rs | 12 | ||||
-rw-r--r-- | cli/tests/testdata/bundle.test.out | 16 | ||||
-rw-r--r-- | cli/tests/testdata/compiler_api_test.ts | 10 |
3 files changed, 22 insertions, 16 deletions
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index 3dd5699c6..18e022cfe 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -63,12 +63,14 @@ fn pty_bad_input() { fn pty_syntax_error_input() { util::with_pty(&["repl"], |mut console| { console.write_line("('\\u')"); - console.write_line("('"); + console.write_line("'"); + console.write_line("[{'a'}];"); console.write_line("close();"); let output = console.read_all_output(); + assert!(output.contains("Expected 4 hex characters")); assert!(output.contains("Unterminated string constant")); - assert!(output.contains("Unexpected eof")); + assert!(output.contains("Expected a semicolon")); }); } @@ -267,7 +269,11 @@ fn typescript_declarations() { Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); - assert!(out.ends_with("undefined\n0\n2\nundefined\nundefined\n")); + let expected_end_text = "undefined\n0\n2\nundefined\nundefined\n"; + assert_eq!( + &out[out.len() - expected_end_text.len()..], + expected_end_text + ); assert!(err.is_empty()); } diff --git a/cli/tests/testdata/bundle.test.out b/cli/tests/testdata/bundle.test.out index 030c09295..6b1c109d3 100644 --- a/cli/tests/testdata/bundle.test.out +++ b/cli/tests/testdata/bundle.test.out @@ -8,20 +8,20 @@ function returnsFoo() { function printHello2() { printHello(); } -function returnsHi1() { +function returnsHi() { return "Hi"; } -function returnsFoo21() { +function returnsFoo2() { return returnsFoo(); } -function printHello31() { +function printHello3() { printHello2(); } -function throwsError1() { +function throwsError() { throw Error("exception from mod1"); } -export { returnsHi1 as returnsHi }; -export { returnsFoo21 as returnsFoo2 }; -export { printHello31 as printHello3 }; -export { throwsError1 as throwsError }; +export { returnsHi as returnsHi }; +export { returnsFoo2 as returnsFoo2 }; +export { printHello3 as printHello3 }; +export { throwsError as throwsError }; diff --git a/cli/tests/testdata/compiler_api_test.ts b/cli/tests/testdata/compiler_api_test.ts index 42d6f54eb..b9755c29a 100644 --- a/cli/tests/testdata/compiler_api_test.ts +++ b/cli/tests/testdata/compiler_api_test.ts @@ -2,8 +2,8 @@ import { assert, assertEquals, + assertRejects, assertStringIncludes, - assertThrowsAsync, } from "../../../test_util/std/testing/asserts.ts"; Deno.test({ @@ -268,7 +268,7 @@ Deno.test({ Object.keys(files).sort(), ["deno:///bundle.js", "deno:///bundle.js.map"].sort(), ); - assert(files["deno:///bundle.js"].includes(`const bar1 = "bar"`)); + assert(files["deno:///bundle.js"].includes(`const bar = "bar"`)); }, }); @@ -312,7 +312,7 @@ Deno.test({ Object.keys(files).sort(), ["deno:///bundle.js.map", "deno:///bundle.js"].sort(), ); - assert(files["deno:///bundle.js"].includes(`const bar1 = "bar"`)); + assert(files["deno:///bundle.js"].includes(`const bar = "bar"`)); }, }); @@ -430,7 +430,7 @@ Deno.test({ Deno.test({ name: `Deno.emit() - throws descriptive error when unable to load import map`, async fn() { - await assertThrowsAsync( + await assertRejects( async () => { await Deno.emit("/a.ts", { bundle: "classic", @@ -566,7 +566,7 @@ Deno.test({ { sources: { "file:///a.tsx": `/** @jsxImportSource https://example.com/jsx */ - + export function App() { return ( <div><></></div> |