diff options
Diffstat (limited to 'cli/tests/integration/bundle_tests.rs')
-rw-r--r-- | cli/tests/integration/bundle_tests.rs | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/cli/tests/integration/bundle_tests.rs b/cli/tests/integration/bundle_tests.rs index 4bd342acd..dd83f0a95 100644 --- a/cli/tests/integration/bundle_tests.rs +++ b/cli/tests/integration/bundle_tests.rs @@ -2,6 +2,8 @@ use crate::itest; use test_util as util; +use test_util::assert_contains; +use test_util::assert_ends_with; use test_util::TempDir; #[test] @@ -39,10 +41,10 @@ fn bundle_exports() { .output() .unwrap(); // check the output of the test.ts program. - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("Hello")); + assert_ends_with!( + std::str::from_utf8(&output.stdout).unwrap().trim(), + "Hello", + ); assert_eq!(output.stderr, b""); } @@ -81,10 +83,10 @@ fn bundle_exports_no_check() { .output() .unwrap(); // check the output of the test.ts program. - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("Hello")); + assert_ends_with!( + std::str::from_utf8(&output.stdout).unwrap().trim(), + "Hello", + ); assert_eq!(output.stderr, b""); } @@ -113,10 +115,10 @@ fn bundle_circular() { .output() .unwrap(); // check the output of the the bundle program. - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("f2\nf1")); + assert_ends_with!( + std::str::from_utf8(&output.stdout).unwrap().trim(), + "f2\nf1", + ); assert_eq!(output.stderr, b""); } @@ -145,10 +147,10 @@ fn bundle_single_module() { .output() .unwrap(); // check the output of the the bundle program. - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("Hello world!")); + assert_ends_with!( + std::str::from_utf8(&output.stdout).unwrap().trim(), + "Hello world!", + ); assert_eq!(output.stderr, b""); } @@ -187,10 +189,10 @@ fn bundle_tla() { .output() .unwrap(); // check the output of the test.ts program. - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("Hello")); + assert_ends_with!( + std::str::from_utf8(&output.stdout).unwrap().trim(), + "Hello", + ); assert_eq!(output.stderr, b""); } @@ -249,10 +251,10 @@ fn bundle_dynamic_import() { .output() .unwrap(); // check the output of the test.ts program. - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("Hello")); + assert_ends_with!( + std::str::from_utf8(&output.stdout).unwrap().trim(), + "Hello", + ); assert_eq!(output.stderr, b""); } @@ -294,10 +296,10 @@ fn bundle_import_map() { .output() .unwrap(); // check the output of the test.ts program. - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("Hello")); + assert_ends_with!( + std::str::from_utf8(&output.stdout).unwrap().trim(), + "Hello", + ); assert_eq!(output.stderr, b""); } @@ -338,10 +340,10 @@ fn bundle_import_map_no_check() { .output() .unwrap(); // check the output of the test.ts program. - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("Hello")); + assert_ends_with!( + std::str::from_utf8(&output.stdout).unwrap().trim(), + "Hello", + ); assert_eq!(output.stderr, b""); } @@ -372,9 +374,7 @@ fn bundle_json_module() { // check that nothing went to stderr assert_eq!(output.stderr, b""); // ensure the output looks right - assert!(String::from_utf8(output.stdout) - .unwrap() - .contains("with space")); + assert_contains!(String::from_utf8(output.stdout).unwrap(), "with space",); } #[test] @@ -404,9 +404,10 @@ fn bundle_json_module_escape_sub() { // check that nothing went to stderr assert_eq!(output.stderr, b""); // make sure the output looks right and the escapes were effective - assert!(String::from_utf8(output.stdout) - .unwrap() - .contains("${globalThis}`and string literal`")); + assert_contains!( + String::from_utf8(output.stdout).unwrap(), + "${globalThis}`and string literal`", + ); } itest!(lock_check_err_with_bundle { |