-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_scan_commands.rs
58 lines (55 loc) · 1.39 KB
/
test_scan_commands.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use assert_cmd::prelude::*;
use predicates::ord::eq;
use std::process::Command;
#[test]
fn cli_sql_scan_table_single_page() {
Command::cargo_bin("rsql")
.unwrap()
.args(["sql", "tests/resources/sample.db", "select * from apples;"])
.assert()
.success()
.stdout(predicates::str::contains(
r#"1|Granny Smith|Light Green
2|Fuji|Red
3|Honeycrisp|Blush Red
4|Golden Delicious|Yellow"#,
));
}
#[ignore]
#[test]
fn cli_sql_scan_table_single_page_projection() {
// subset columns
Command::cargo_bin("rsql")
.unwrap()
.args([
"sql",
"tests/resources/sample.db",
"select name from apples;",
])
.assert()
.success()
.stdout(eq(r#"Granny Smith
Fuji
Honeycrisp
Golden Delicious"#));
}
#[ignore]
#[test]
fn cli_sql_scan_table_multiple_pages() {
// Traversing only the first table page is not enough to pass this test
Command::cargo_bin("rsql")
.unwrap()
.args([
"sql",
"tests/resources/superheroes.db",
"SELECT id, name FROM superheroes WHERE eye_color = 'Pink Eyes';",
])
.assert()
.success()
.stdout(eq(r#"297|Stealth (New Earth)
790|Tobias Whale (New Earth)
1085|Felicity (New Earth)
2729|Thrust (New Earth)
3289|Angora Lapin (New Earth)
3913|Matris Ater Clementia (New Earth)"#));
}