Skip to content

Commit

Permalink
add test for array of numbers (works with existing implementation)
Browse files Browse the repository at this point in the history
  • Loading branch information
n14little committed May 18, 2020
1 parent 1b13a8b commit 9158ec1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion boa/src/builtins/json/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn json_stringify_remove_function_values_from_objects() {
}

#[test]
fn json_stringify_replacer_array() {
fn json_stringify_replacer_array_strings() {
let realm = Realm::create();
let mut engine = Executor::new(realm);
let actual = forward(
Expand All @@ -50,3 +50,15 @@ fn json_stringify_replacer_array() {
let expected = forward(&mut engine, r#"'{"aaa":"bbb","bbb":"ccc"}'"#);
assert_eq!(actual, expected);
}

#[test]
fn json_stringify_replacer_array_numbers() {
let realm = Realm::create();
let mut engine = Executor::new(realm);
let actual = forward(
&mut engine,
r#"JSON.stringify({ 0: 'aaa', 1: 'bbb', 2: 'ccc'}, [1, 2])"#,
);
let expected = forward(&mut engine, r#"'{"1":"bbb","2":"ccc"}'"#);
assert_eq!(actual, expected);
}

0 comments on commit 9158ec1

Please sign in to comment.