Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
6 changes: 6 additions & 0 deletions tests/main_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mod common;
mod suites {
pub mod basic_crud;
pub mod set_operators;
pub mod transactions;
}
9 changes: 2 additions & 7 deletions tests/crud_test.rs → tests/suites/basic_crud.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
mod test_utils;

use mollycache::db::database::Database;
use mollycache::db::table::core::{row::Row, value::Value};
use mollycache::interpreter::run_sql;

use crate::test_utils::{assert_eq_run_sql, assert_eq_table_rows, assert_eq_table_rows_unordered};
use crate::common::{assert_eq_run_sql, assert_eq_table_rows, assert_eq_table_rows_unordered};

#[test]
fn test_select_with_order_by_and_offset() {
Expand Down Expand Up @@ -133,10 +131,7 @@ fn test_complex_statements_crud() {
Row(vec![Value::Text("John".to_string()), Value::Integer(25)]),
];
let expected_second = vec![Row(vec![Value::Integer(80)])];
test_utils::assert_eq_table_rows_unordered(
expected_second,
result.pop().unwrap().unwrap().unwrap(),
);
assert_eq_table_rows_unordered(expected_second, result.pop().unwrap().unwrap().unwrap());
assert!(result.pop().unwrap().unwrap().is_none());
assert_eq_table_rows_unordered(expected_first, result.pop().unwrap().unwrap().unwrap());
assert!(
Expand Down
11 changes: 3 additions & 8 deletions tests/set_operators_test.rs → tests/suites/set_operators.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
mod test_utils;

use mollycache::db::database::Database;
use mollycache::db::table::core::{row::Row, value::Value};
use mollycache::interpreter::run_sql;

use crate::test_utils::assert_eq_table_rows;
use crate::common::{assert_eq_table_rows, assert_eq_table_rows_unordered};

#[test]
fn test_set_operators() {
Expand All @@ -24,7 +22,7 @@ fn test_set_operators() {
Row(vec![Value::Text("Jack".to_string())]),
];
let row = result.pop().unwrap().unwrap().unwrap();
test_utils::assert_eq_table_rows_unordered(expected, row);
assert_eq_table_rows_unordered(expected, row);
assert!(
result
.into_iter()
Expand Down Expand Up @@ -99,10 +97,7 @@ fn test_set_operators_with_different_tables_and_clause() {
Row(vec![Value::Text("Jim".to_string())]),
Row(vec![Value::Text("Jack".to_string())]),
];
test_utils::assert_eq_table_rows_unordered(
expected_first,
result.pop().unwrap().unwrap().unwrap(),
);
assert_eq_table_rows_unordered(expected_first, result.pop().unwrap().unwrap().unwrap());
assert!(
result
.into_iter()
Expand Down
4 changes: 1 addition & 3 deletions tests/transaction_test.rs → tests/suites/transactions.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
mod test_utils;

use mollycache::db::database::Database;
use mollycache::db::table::core::{row::Row, value::Value};
use mollycache::interpreter::run_sql;

use crate::test_utils::assert_eq_run_sql_unordered;
use crate::common::assert_eq_run_sql_unordered;

#[test]
fn test_transaction() {
Expand Down
Loading