Skip to content

Commit 1b2eca7

Browse files
committed
Formatted
1 parent d73c885 commit 1b2eca7

6 files changed

Lines changed: 32 additions & 18 deletions

File tree

tests/api_main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ mod util;
33

44
use {
55
multisql::{Connection, Glue},
6-
util::{run, Test},
6+
util::*,
77
};
88

99
inventory::collect!(Test);
1010

1111
fn main() {
12+
announce_test_suite!();
1213
for test in inventory::iter::<Test> {
1314
run!(test, init_storage);
1415
}

tests/databases_main.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ mod ability;
22
mod databases;
33
mod util;
44

5-
use {
6-
multisql::Glue,
7-
util::{run, Test},
8-
};
5+
use {multisql::Glue, util::*};
96

107
inventory::collect!(Test);
118
inventory::collect!(TestDatabase);
@@ -16,15 +13,14 @@ struct TestDatabase {
1613
}
1714

1815
fn main() {
16+
announce_test_suite!();
1917
for database in inventory::iter::<TestDatabase> {
20-
println!(
21-
"- - -\t- - -\t- - -\t- - -\t- - -\t- - -\t- - -\t- - -\t- - -
22-
\nTesting database:\t {}
23-
\n- - -\t- - -\t- - -\t- - -\t- - -\t- - -\t- - -\t- - -\t- - -",
24-
database.name
25-
);
18+
announce!(format!("[Database]\t{}", database.name));
2619
for test in inventory::iter::<Test> {
27-
let name = test.name.strip_prefix(concat!(module_path!(), "::", "ability::")).unwrap();
20+
let name = test
21+
.name
22+
.strip_prefix(concat!(module_path!(), "::", "ability::"))
23+
.unwrap();
2824
if !database
2925
.exceptions
3026
.iter()

tests/functionality_main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ mod util;
33

44
use {
55
multisql::{Connection, Glue},
6-
util::{run, Test},
6+
util::*,
77
};
88

99
inventory::collect!(Test);
1010

1111
fn main() {
12+
announce_test_suite!();
1213
for test in inventory::iter::<Test> {
1314
run!(test, init_storage);
1415
}

tests/misc_main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ mod util;
33

44
use {
55
multisql::{Connection, Glue},
6-
util::{run, Test},
6+
util::*,
77
};
88

99
inventory::collect!(Test);
1010

1111
fn main() {
12+
announce_test_suite!();
1213
for test in inventory::iter::<Test> {
1314
run!(test, init_storage);
1415
}

tests/query_main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ mod util;
33

44
use {
55
multisql::{Connection, Glue},
6-
util::{run, Test},
6+
util::*,
77
};
88

99
inventory::collect!(Test);
1010

1111
fn main() {
12+
announce_test_suite!();
1213
for test in inventory::iter::<Test> {
1314
run!(test, init_storage);
1415
}

tests/util/mod.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ macro_rules! run {
3232
);
3333
progress.set_style(
3434
ProgressStyle::default_spinner()
35-
.template("[Running]\t {msg:50.yellow} {spinner}")
35+
.template("\t[Running]\t{msg:.yellow} {spinner}")
3636
.tick_chars("|/—\\*"),
3737
);
3838
progress.enable_steady_tick(100);
3939
// progress.tick(); // Aesthetic -- in case too fast
4040
match catch_unwind(|| ($test.test)($storage($test.name))) {
4141
Ok(_) => {
4242
progress.set_style(
43-
ProgressStyle::default_spinner().template("[Passed]\t {msg:50.green}"),
43+
ProgressStyle::default_spinner().template("\t[Passed]\t{msg:.green}"),
4444
);
4545
progress.finish();
4646
}
4747
Err(err) => {
4848
progress.set_style(
49-
ProgressStyle::default_spinner().template("[Failed]\t {msg:50.red} {spinner}"),
49+
ProgressStyle::default_spinner().template("\t[Failed]\t{msg:.red} {spinner}"),
5050
);
5151
progress.finish();
5252
panic!("Test Failed; Error: {:?}", err);
@@ -56,6 +56,20 @@ macro_rules! run {
5656
}
5757
pub(crate) use run;
5858

59+
macro_rules! announce {
60+
($content: expr) => {
61+
println!("\t{}", $content)
62+
};
63+
}
64+
pub(crate) use announce;
65+
66+
macro_rules! announce_test_suite {
67+
() => {
68+
announce!(format!("[Suite]\t\t{}", module_path!()))
69+
};
70+
}
71+
pub(crate) use announce_test_suite;
72+
5973
macro_rules! make_basic_table {
6074
($glue: expr) => {
6175
$glue

0 commit comments

Comments
 (0)