mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-05 18:58:58 -06:00
This pr addresses the linked of issue of fault exporting of json like data with prettyPrint. The solution on the csv end was opening the csv writer to the pretty print pipeline.
BATS - Bash Automated Testing System
We are going to use bats to test the dolt command line.
First you need to install bats.
npm install -g bats
Then, go to the directory with the bats tests and run:
bats .
This will run all the tests. Specify a particular .bats file to run only those tests.
Here Docs
BATS tests in Dolt make extensive use of Here Docs.
Common patterns include piping SQL scripts to dolt sql:
dolt sql <<SQL
CREATE TABLE my_table (pk int PRIMARY KEY);
SQL
And creating data files for import:
cat <<DELIM > data.csv
pk,c1,c2
1,1,1
2,2,2
DELIM
dolt table import -c -pk=pk my_table data.csv
Skipped BATS
Various tests are skipped as TODOs and/or as documentation of known bugs. Eg:
@test "..." {
...
skip "this test is currently failing because..."
}
Skipped BATS can still be partially useful for testing as they execute normally up to skip statement.