Skip to content

Commit

Permalink
Add test to check case of field.
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-uk1 committed Jan 7, 2019
1 parent 46d4330 commit 3d2efb0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/webidl-tests/dictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ global.assert_dict_required = function(c) {
assert.strictEqual(c.b, "a");
assert.strictEqual(c.c, 4);
};

global.assert_camel_case = function(dict) {
assert.strictEqual(dict.wierd_fieldName, 1);
}
6 changes: 6 additions & 0 deletions crates/webidl-tests/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ extern "C" {
#[wasm_bindgen(js_name = mk_dict_a)]
fn mk_dict_a2() -> Option<A>;
fn assert_dict_required(r: &Required);
fn assert_camel_case(dict: &PreserveNames);
}

#[wasm_bindgen_test]
Expand Down Expand Up @@ -51,3 +52,8 @@ fn many_types() {
fn required() {
assert_dict_required(Required::new(3, "a").c(4));
}

#[wasm_bindgen_test]
fn correct_casing_in_js() {
assert_camel_case(PreserveNames::new().wierd_field_name(4));
}
4 changes: 4 additions & 0 deletions crates/webidl-tests/dictionary.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ dictionary Required {
required long a;
long c;
};

dictionary PreserveNames {
long wierd_fieldName;
};

0 comments on commit 3d2efb0

Please sign in to comment.