mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
* stub out a test framework for fbsql * Introduce fbsql integration test framework. This also adds support for `pset location` to set the geo location (i.e. time zone) in which timestamps should be displayed. And it adds support for comments (lines starting with `--`) in the line reader/splitter. * Replace Stdin and Stderr with setters and un-export them
67 lines
1.6 KiB
Text
67 lines
1.6 KiB
Text
SEND:SELECT * FROM users;
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:| _id | name | age |
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:| 1 | Anne | 38 |
|
|
EXPECT:| 2 | Bill | 23 |
|
|
EXPECT:| 3 | Cindy | 64 |
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:
|
|
|
|
// Redirect output to a file.
|
|
SEND:\o test-output-file
|
|
SEND:SELECT * FROM users;
|
|
|
|
// Ensure the output went to the file.
|
|
SEND:\! cat test-output-file
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:| _id | name | age |
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:| 1 | Anne | 38 |
|
|
EXPECT:| 2 | Bill | 23 |
|
|
EXPECT:| 3 | Cindy | 64 |
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:
|
|
|
|
// Let's test some qecho stuff here while we're at it.
|
|
SEND:\qecho string with "double quotes"
|
|
SEND:\qecho -n one
|
|
SEND:\qecho -n two
|
|
SEND:\qecho three
|
|
SEND:\qecho four
|
|
|
|
SEND:\! cat test-output-file
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:| _id | name | age |
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:| 1 | Anne | 38 |
|
|
EXPECT:| 2 | Bill | 23 |
|
|
EXPECT:| 3 | Cindy | 64 |
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:
|
|
EXPECT:string with "double quotes"
|
|
EXPECT:onetwothree
|
|
EXPECT:four
|
|
|
|
// And \warn messages should still go to stderr, not the file.
|
|
SEND:\warn a warning string
|
|
EXPECT:a warning string
|
|
|
|
// Remove the file.
|
|
SEND:\! rm test-output-file
|
|
|
|
// Set the output back to stdout.
|
|
SEND:\o
|
|
SEND:SELECT * FROM users;
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:| _id | name | age |
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:| 1 | Anne | 38 |
|
|
EXPECT:| 2 | Bill | 23 |
|
|
EXPECT:| 3 | Cindy | 64 |
|
|
EXPECT:+-----+-------+-----+
|
|
EXPECT:
|
|
|
|
// Ensure extra arguments to \output causes an error.
|
|
SEND:\o filename extra
|
|
EXPECT:executing meta command: meta command 'output' takes zero or one argument
|