Skip to content

Commit

Permalink
Re-enable test_bits (nushell#7585)
Browse files Browse the repository at this point in the history
The tests in `src/tests/test_bits.rs` weren't being run because we were
missing a `mod test_bits;`. Fixed.
  • Loading branch information
rgwood authored Dec 23, 2022
1 parent b16b3c0 commit 5041a4f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod test_bits;
mod test_cell_path;
mod test_conditionals;
mod test_config_path;
Expand Down
32 changes: 25 additions & 7 deletions src/tests/test_bits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::tests::{fail_test, run_test, TestResult};
use crate::tests::{run_test, TestResult};

#[test]
fn bits_and() -> TestResult {
Expand Down Expand Up @@ -27,7 +27,10 @@ fn bits_or_negative() -> TestResult {

#[test]
fn bits_or_list() -> TestResult {
run_test("[1 2 3 8 9 10] | bits or 2 | str join '.'", "3.2.3.10.11.10")
run_test(
"[1 2 3 8 9 10] | bits or 2 | str join '.'",
"3.2.3.10.11.10",
)
}

#[test]
Expand All @@ -42,7 +45,10 @@ fn bits_xor_negative() -> TestResult {

#[test]
fn bits_xor_list() -> TestResult {
run_test("[1 2 3 8 9 10] | bits xor 2 | str join '.'", "3.0.1.10.11.8")
run_test(
"[1 2 3 8 9 10] | bits xor 2 | str join '.'",
"3.0.1.10.11.8",
)
}

#[test]
Expand All @@ -57,7 +63,10 @@ fn bits_shift_left_negative() -> TestResult {

#[test]
fn bits_shift_left_list() -> TestResult {
run_test("[1 2 7 32 9 10] | bits shl 3 | str join '.'", "8.16.56.256.72.80")
run_test(
"[1 2 7 32 9 10] | bits shl 3 | str join '.'",
"8.16.56.256.72.80",
)
}

#[test]
Expand All @@ -72,7 +81,10 @@ fn bits_shift_right_negative() -> TestResult {

#[test]
fn bits_shift_right_list() -> TestResult {
run_test("[12 98 7 64 900 10] | bits shr 3 | str join '.'", "1.12.0.8.112.1")
run_test(
"[12 98 7 64 900 10] | bits shr 3 | str join '.'",
"1.12.0.8.112.1",
)
}

#[test]
Expand All @@ -87,7 +99,10 @@ fn bits_rotate_left_negative() -> TestResult {

#[test]
fn bits_rotate_left_list() -> TestResult {
run_test("[1 2 7 32 9 10] | bits rol 3 | str join '.'", "8.16.56.256.72.80")
run_test(
"[1 2 7 32 9 10] | bits rol 3 | str join '.'",
"8.16.56.256.72.80",
)
}

#[test]
Expand All @@ -102,5 +117,8 @@ fn bits_rotate_right_negative() -> TestResult {

#[test]
fn bits_rotate_right_list() -> TestResult {
run_test("[1 2 7 32 23 10] | bits ror 60 | str join '.'", "16.32.112.512.368.160")
run_test(
"[1 2 7 32 23 10] | bits ror 60 | str join '.'",
"16.32.112.512.368.160",
)
}

0 comments on commit 5041a4f

Please sign in to comment.