Skip to content

Commit

Permalink
tests: Switch assert_eq statements left-right
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Jun 16, 2023
1 parent 58a4c40 commit 458eca3
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 59 deletions.
16 changes: 8 additions & 8 deletions tests/all/add_predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn add_predicate_single_true() {
| | add some | |
| | multi line stuff | |
+----------------------+----------------------+------------------------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -61,7 +61,7 @@ fn add_predicate_single_false() {
+================================================================+
| This is a text | This is another text | This is the third text |
+----------------+----------------------+------------------------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -98,7 +98,7 @@ fn add_predicate_single_mixed() {
| | add some | |
| | multi line stuff | |
+----------------------+----------------------+------------------------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -127,7 +127,7 @@ fn add_predicate_single_wrong_row_count() {
+================================================================+
| This is a text | This is another text | This is the third text |
+----------------+----------------------+------------------------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -161,7 +161,7 @@ fn add_predicate_multi_true() {
| | add some | |
| | multi line stuff | |
+----------------------+----------------------+------------------------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -190,7 +190,7 @@ fn add_predicate_multi_false() {
+================================================================+
| This is a text | This is another text | This is the third text |
+----------------+----------------------+------------------------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -232,7 +232,7 @@ fn add_predicate_multi_mixed() {
| | add some | |
| | multi line stuff | |
+----------------------+----------------------+------------------------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -261,5 +261,5 @@ fn add_predicate_multi_wrong_rows_count() {
+================================================================+
| This is a text | This is another text | This is the third text |
+----------------+----------------------+------------------------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
2 changes: 1 addition & 1 deletion tests/all/alignment_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ fn cell_alignment() {
|---------------------+---------------------+---------------------|
| Left | Center | Right |
+---------------------+---------------------+---------------------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
2 changes: 1 addition & 1 deletion tests/all/combined_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ fn combined_features() {
│ ┆ atshoulddynamicallywrap ┆ │
└─────────────────────┴───────────────────────────────┴────────────────────────┘";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
22 changes: 11 additions & 11 deletions tests/all/constraints_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn fixed_max_min_constraints() {
| | stuff | |
+----------+--------+----------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());

// Now try this again when using dynamic content arrangement
// The table tries to arrange to 28 characters,
Expand Down Expand Up @@ -98,7 +98,7 @@ fn fixed_max_min_constraints() {
| | f | |
+----------+----+----------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand All @@ -121,7 +121,7 @@ fn unnecessary_max_min_constraints() {
| | multi line stuff | |
+------+----------------------+------------------------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());

// Now test for dynamic content arrangement
table.set_content_arrangement(ContentArrangement::Dynamic);
Expand All @@ -137,7 +137,7 @@ fn unnecessary_max_min_constraints() {
| | multi line stuff | |
+------+----------------------+------------------------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -175,7 +175,7 @@ fn constraints_bigger_than_table_width() {
| l | | |
+---+------------------------------+------------------------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -205,7 +205,7 @@ fn percentage() {
| | stuff | |
+-------+---------------+--------------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand All @@ -228,7 +228,7 @@ fn max_100_percentage() {
+--------------------------------------+";
println!("{expected}");
assert_table_line_width(&table, 40);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -261,7 +261,7 @@ fn percentage_second() {
| | stuff | |
+--------------+----------+----------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -294,7 +294,7 @@ fn max_percentage() {
| | stuff | |
+------+----------+----------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand Down Expand Up @@ -333,7 +333,7 @@ fn min_max_boundary() {
| | stuff | |
+------------------+---------------+----------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[rstest::rstest]
Expand All @@ -353,5 +353,5 @@ fn empty_table(#[case] arrangement: ContentArrangement) {
| |
+---+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
18 changes: 9 additions & 9 deletions tests/all/content_arrangement_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn simple_dynamic_table() {
+--------+-------+------+";
println!("{expected}");
assert_table_line_width(&table, 25);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

/// Individual rows can be configured to have a max height.
Expand Down Expand Up @@ -121,7 +121,7 @@ fn table_with_truncate() {
+----------------+--------+-------+";
println!("{expected}");
assert_table_line_width(&table, 35);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

/// This table checks the scenario, where a column has a big max_width, but a lot of the assigned
Expand Down Expand Up @@ -152,7 +152,7 @@ fn distribute_space_after_split() {
println!("{expected}");

assert_table_line_width(&table, 80);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

/// A single column get's split and a lot of the available isn't used afterward.
Expand All @@ -176,7 +176,7 @@ fn unused_space_after_split() {
+---------------------+";
println!("{expected}");
assert_table_line_width(&table, 23);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

/// The full width of a table should be used, even if the space isn't used.
Expand All @@ -199,7 +199,7 @@ fn dynamic_full_width_after_split() {
+------------------------------------------------+";
println!("{expected}");
assert_table_line_width(&table, 50);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

/// This table checks the scenario, where a column has a big max_width, but a lot of the assigned
Expand All @@ -223,7 +223,7 @@ fn dynamic_full_width() {
+-----------------------------------+----------------------+-------------------+";
println!("{expected}");
assert_table_line_width(&table, 80);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

/// Test that a table is displayed in its full width, if the `table.width` is set to the exact
Expand Down Expand Up @@ -263,7 +263,7 @@ fn dynamic_exact_width() {
└─────┴─────┴───────────┘";
println!("{expected}");
assert_table_line_width(table, 25);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
}

Expand Down Expand Up @@ -302,7 +302,7 @@ fn dynamic_slightly_smaller() {
└─────┴─────┴──────────┘";
println!("{expected}");
assert_table_line_width(table, 24);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

/// This failed on a python integration test case in the polars project.
Expand Down Expand Up @@ -348,5 +348,5 @@ fn polar_python_test_tbl_width_chars() {
└───────────────────┴─────────────────────────────────────┴────────────┘";
println!("{expected}");
assert_table_line_width(table, 72);
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
2 changes: 1 addition & 1 deletion tests/all/custom_delimiter_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ fn full_custom_delimiters() {
| | g else. |
+-------------------+------------------+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
6 changes: 3 additions & 3 deletions tests/all/hidden_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn hidden_columns() {
│ ┆ add some ┆ │
│ ┆ multi line stuff ┆ │
└──────┴──────────────────────┴────────────────────────┘";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

/// Make sure dynamic adjustment still works with hidden columns
Expand Down Expand Up @@ -99,7 +99,7 @@ fn hidden_columns_with_dynamic_adjustment() {
│ ┆ line ┆ │
│ ┆ stuff ┆ │
└──────┴────────┴───────┘";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

/// Nothing breaks, if all columns are hidden
Expand All @@ -121,5 +121,5 @@ fn only_hidden_columns() {
╞╡
├┤
└┘";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
6 changes: 3 additions & 3 deletions tests/all/inner_style_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn styled_table() {
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ cell5 ┆ cell6 │
└─────────────────────────────────────────┴─────────────────────────────────────────┘";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand All @@ -73,7 +73,7 @@ fn no_style_styled_table() {
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ cell5 ┆ cell6 │
└─────────────────────────────────────────┴─────────────────────────────────────────┘";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}

#[test]
Expand All @@ -94,5 +94,5 @@ fn styled_text_only_table() {
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ cell5 ┆ cell6 │
└─────────────────────────────────────────┴─────────────────────────────────────────┘";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
2 changes: 1 addition & 1 deletion tests/all/modifiers_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ fn utf8_round_corners() {
╰─────────┴─────────┴───────────╯";

println!("{table}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
2 changes: 1 addition & 1 deletion tests/all/padding_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ fn custom_padding() {
|-------------------+-----------+-----------|
| Three One | Three Two |Three Three|
+-------------------+-----------+-----------+";
assert_eq!("\n".to_string() + &table.to_string(), expected);
assert_eq!(expected, "\n".to_string() + &table.to_string());
}
Loading

0 comments on commit 458eca3

Please sign in to comment.