Migrate methods to new naming scheme

Allows deletion of `create_basic_method`!
This commit is contained in:
Alex Crichton
2018-08-29 17:33:35 -07:00
parent 15d4338abe
commit 5a4a34d4a1
4 changed files with 116 additions and 214 deletions

View File

@ -82,12 +82,12 @@ fn optional_and_union_arguments() {
let f = OptionalAndUnionArguments::new().unwrap();
assert_eq!(f.m("abc"), "string, abc, boolean, true, number, 123, number, 456");
assert_eq!(f.m_with_b("abc", false), "string, abc, boolean, false, number, 123, number, 456");
assert_eq!(f.m_with_bool_and_i16("abc", false, 5), "string, abc, boolean, false, number, 5, number, 456");
assert_eq!(f.m_with_bool_and_str("abc", false, "5"), "string, abc, boolean, false, string, 5, number, 456");
assert_eq!(f.m_with_bool_and_i16_and_opt_i64("abc", false, 5, Some(10)), "string, abc, boolean, false, number, 5, bigint, 10");
assert_eq!(f.m_with_bool_and_i16_and_opt_bool("abc", false, 5, Some(true)), "string, abc, boolean, false, number, 5, boolean, true");
assert_eq!(f.m_with_bool_and_str_and_opt_i64("abc", false, "5", Some(10)), "string, abc, boolean, false, string, 5, bigint, 10");
assert_eq!(f.m_with_bool_and_str_and_opt_bool("abc", false, "5", Some(true)), "string, abc, boolean, false, string, 5, boolean, true");
assert_eq!(f.m_with_b_and_i16("abc", false, 5), "string, abc, boolean, false, number, 5, number, 456");
assert_eq!(f.m_with_b_and_str("abc", false, "5"), "string, abc, boolean, false, string, 5, number, 456");
assert_eq!(f.m_with_b_and_i16_and_opt_i64("abc", false, 5, Some(10)), "string, abc, boolean, false, number, 5, bigint, 10");
assert_eq!(f.m_with_b_and_i16_and_opt_bool("abc", false, 5, Some(true)), "string, abc, boolean, false, number, 5, boolean, true");
assert_eq!(f.m_with_b_and_str_and_opt_i64("abc", false, "5", Some(10)), "string, abc, boolean, false, string, 5, bigint, 10");
assert_eq!(f.m_with_b_and_str_and_opt_bool("abc", false, "5", Some(true)), "string, abc, boolean, false, string, 5, boolean, true");
}
#[wasm_bindgen_test]
@ -118,7 +118,9 @@ fn mixin() {
#[wasm_bindgen_test]
fn overload_naming() {
let o = Overloads::new().unwrap();
// o.foo();
// o.foo_with_arg("x");
// o.foo_with_arg_and_a("x", 3);
o.foo();
o.foo_with_arg("x");
o.foo_with_arg_and_i32("x", 3);
o.foo_with_arg_and_f32("x", 2.0);
o.foo_with_arg_and_i16("x", 5);
}