Skip to content

Commit

Permalink
Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Mar 1, 2023
1 parent e18e268 commit e909f81
Show file tree
Hide file tree
Showing 31 changed files with 673 additions and 673 deletions.
92 changes: 46 additions & 46 deletions boa_engine/src/builtins/array/tests.rs

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions boa_engine/src/builtins/bigint/tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{builtins::error::ErrorKind, run_test, JsBigInt, TestAction};
use crate::{builtins::error::ErrorKind, run_test_actions, JsBigInt, TestAction};

#[test]
fn equality() {
run_test([
run_test_actions([
TestAction::assert("0n == 0n"),
TestAction::assert("!(1n == 0n)"),
TestAction::assert(
Expand Down Expand Up @@ -35,7 +35,7 @@ fn equality() {

#[test]
fn bigint_function_conversion_from_integer() {
run_test([
run_test_actions([
TestAction::assert_eq("BigInt(1000)", JsBigInt::from(1000)),
TestAction::assert_eq(
"BigInt(20000000000000000)",
Expand All @@ -50,7 +50,7 @@ fn bigint_function_conversion_from_integer() {

#[test]
fn bigint_function_conversion_from_rational() {
run_test([
run_test_actions([
TestAction::assert_eq("BigInt(0.0)", JsBigInt::from(0)),
TestAction::assert_eq("BigInt(1.0)", JsBigInt::from(1)),
TestAction::assert_eq("BigInt(10000.0)", JsBigInt::from(10_000)),
Expand All @@ -59,7 +59,7 @@ fn bigint_function_conversion_from_rational() {

#[test]
fn bigint_function_throws() {
run_test([
run_test_actions([
TestAction::assert_native_error(
"BigInt(0.1)",
ErrorKind::Range,
Expand All @@ -80,7 +80,7 @@ fn bigint_function_throws() {

#[test]
fn bigint_function_conversion_from_string() {
run_test([
run_test_actions([
TestAction::assert_eq("BigInt('')", JsBigInt::from(0)),
TestAction::assert_eq("BigInt(' ')", JsBigInt::from(0)),
TestAction::assert_eq(
Expand All @@ -99,7 +99,7 @@ fn bigint_function_conversion_from_string() {

#[test]
fn operations() {
run_test([
run_test_actions([
TestAction::assert_eq("10000n + 1000n", JsBigInt::from(11_000)),
TestAction::assert_eq("10000n - 1000n", JsBigInt::from(9_000)),
TestAction::assert_eq(
Expand Down Expand Up @@ -138,7 +138,7 @@ fn operations() {

#[test]
fn to_string() {
run_test([
run_test_actions([
TestAction::assert_eq("1000n.toString()", "1000"),
TestAction::assert_eq("1000n.toString(2)", "1111101000"),
TestAction::assert_eq("255n.toString(16)", "ff"),
Expand All @@ -148,7 +148,7 @@ fn to_string() {

#[test]
fn to_string_invalid_radix() {
run_test([
run_test_actions([
TestAction::assert_native_error(
"10n.toString(null)",
ErrorKind::Range,
Expand All @@ -169,7 +169,7 @@ fn to_string_invalid_radix() {

#[test]
fn as_int_n() {
run_test([
run_test_actions([
TestAction::assert_eq("BigInt.asIntN(0, 1n)", JsBigInt::from(0)),
TestAction::assert_eq("BigInt.asIntN(1, 1n)", JsBigInt::from(-1)),
TestAction::assert_eq("BigInt.asIntN(3, 10n)", JsBigInt::from(2)),
Expand Down Expand Up @@ -216,7 +216,7 @@ fn as_int_n() {

#[test]
fn as_int_n_errors() {
run_test([
run_test_actions([
TestAction::assert_native_error(
"BigInt.asIntN(-1, 0n)",
ErrorKind::Range,
Expand All @@ -242,7 +242,7 @@ fn as_int_n_errors() {

#[test]
fn as_uint_n() {
run_test([
run_test_actions([
TestAction::assert_eq("BigInt.asUintN(0, -2n)", JsBigInt::from(0)),
TestAction::assert_eq("BigInt.asUintN(0, -1n)", JsBigInt::from(0)),
TestAction::assert_eq("BigInt.asUintN(0, 0n)", JsBigInt::from(0)),
Expand Down Expand Up @@ -289,7 +289,7 @@ fn as_uint_n() {

#[test]
fn as_uint_n_errors() {
run_test([
run_test_actions([
TestAction::assert_native_error(
"BigInt.asUintN(-1, 0n)",
ErrorKind::Range,
Expand Down
8 changes: 4 additions & 4 deletions boa_engine/src/builtins/boolean/tests.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use crate::{run_test, TestAction};
use crate::{run_test_actions, TestAction};
use indoc::indoc;

/// Test the correct type is returned from call and construct
#[allow(clippy::unwrap_used)]
#[test]
fn construct_and_call() {
run_test([
run_test_actions([
TestAction::assert_with_op("new Boolean(1)", |val, _| val.is_object()),
TestAction::assert_with_op("Boolean(0)", |val, _| val.is_boolean()),
]);
}

#[test]
fn constructor_gives_true_instance() {
run_test([
run_test_actions([
TestAction::run(indoc! {r#"
var trueVal = new Boolean(true);
var trueNum = new Boolean(1);
Expand All @@ -35,7 +35,7 @@ fn constructor_gives_true_instance() {

#[test]
fn instances_have_correct_proto_set() {
run_test([TestAction::assert(
run_test_actions([TestAction::assert(
"Object.getPrototypeOf(new Boolean(true)) === Boolean.prototype",
)]);
}
Loading

0 comments on commit e909f81

Please sign in to comment.