1 use crate::assert_js; 2 3 #[test] type_()4fn type_() { 5 assert_js!(r#"pub external type Thing"#,); 6 } 7 8 #[test] module_fn()9fn module_fn() { 10 assert_js!(r#"external fn show(anything) -> Nil = "utils" "inspect""#,); 11 } 12 13 #[test] pub_module_fn()14fn pub_module_fn() { 15 assert_js!(r#"pub external fn show(anything) -> Nil = "utils" "inspect""#,); 16 } 17 18 #[test] global_fn()19fn global_fn() { 20 assert_js!(r#"external fn down(Float) -> Float = "" "Math.floor""#,); 21 } 22 23 #[test] pub_global_fn()24fn pub_global_fn() { 25 assert_js!(r#"pub external fn down(Float) -> Float = "" "Math.floor""#,); 26 } 27 28 #[test] same_name_global_external()29fn same_name_global_external() { 30 assert_js!(r#"pub external fn fetch(Nil) -> Nil = "" "fetch""#,); 31 } 32 33 #[test] same_module_multiple_imports()34fn same_module_multiple_imports() { 35 assert_js!( 36 r#"pub external fn one() -> Nil = "./the/module.js" "one" 37 pub external fn two() -> Nil = "./the/module.js" "two" 38 "#, 39 ); 40 } 41 42 #[test] duplicate_import()43fn duplicate_import() { 44 assert_js!( 45 r#"pub external fn one() -> Nil = "./the/module.js" "dup" 46 pub external fn two() -> Nil = "./the/module.js" "dup" 47 "#, 48 ); 49 } 50 51 #[test] name_to_escape()52fn name_to_escape() { 53 assert_js!( 54 r#"pub external fn class() -> Nil = "./the/module.js" "one" 55 "#, 56 ); 57 } 58