Skip to content

Commit

Permalink
Removed Windows carriage-return and trailing whitespace from bats tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydrocharged committed Jan 23, 2020
1 parent 62538be commit a8ee8c3
Show file tree
Hide file tree
Showing 17 changed files with 591 additions and 591 deletions.
12 changes: 6 additions & 6 deletions bats/1pk5col-ints.bats
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ teardown() {

# Create a single primary key table and do stuff
@test "create a table with a schema file and examine repo" {
# Remove the docs, because they will show up in the diff below and break the lines[x] assertions.
# Remove the docs, because they will show up in the diff below and break the lines[x] assertions.
rm LICENSE.md
rm README.md
run dolt ls
Expand All @@ -49,7 +49,7 @@ teardown() {
[ "$status" -eq 0 ]
[[ "$output" =~ "Changes to be committed" ]]
[[ "$output" =~ "new table:" ]] || false
run dolt reset test
run dolt reset test
[ "$status" -eq 0 ]
[ "$output" = "" ]
run dolt status
Expand All @@ -75,7 +75,7 @@ teardown() {
@test "dolt log with -n specified" {
dolt add test
dolt commit -m "first commit"
run dolt log
run dolt log
[ "$status" -eq "0" ]
[[ "$output" =~ "first commit" ]] || false
[[ "$output" =~ "Initialize data repository" ]] || false
Expand Down Expand Up @@ -375,7 +375,7 @@ if rows[2] != "9,8,7,6,5,4".split(","):
dolt sql -q "insert into test values (0, 1, 2, 3, 4, 5)"
dolt add test
dolt commit -m "added test row"
run dolt branch -d test-branch
run dolt branch -d test-branch
[ "$status" -ne 0 ]
[ "$output" = "error: Cannot delete checked out branch 'test-branch'" ]
dolt checkout master
Expand Down Expand Up @@ -426,7 +426,7 @@ if rows[2] != "9,8,7,6,5,4".split(","):

@test "generate a merge conflict and try to roll back using dolt merge --abort" {
# L&R must be removed (or added and committed) in order to test merge
rm "LICENSE.md"
rm "LICENSE.md"
rm "README.md"
dolt add test
dolt commit -m "added test table"
Expand Down Expand Up @@ -626,7 +626,7 @@ if rows[2] != "9,8,7,6,5,4".split(","):
[ "$status" -eq 0 ]
[[ "$output" =~ "<NULL>" ]] || false
[ "$output" = "$doltsqloutput" ]
# Make sure we don't get a table with no spaces because that bug was
# Make sure we don't get a table with no spaces because that bug was
# generated when making changes to NULL printing
[[ ! "$output" =~ "|||||" ]] || false
}
Expand Down
8 changes: 4 additions & 4 deletions bats/1pk5col-strings.bats
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SQL
teardown() {
teardown_common
}

@test "export a table with a string with commas to csv" {
run dolt sql -q "insert into test values ('tim', 'is', 'super', 'duper', 'rad', 'a,b,c,d,e')"
[ "$status" -eq 0 ]
Expand Down Expand Up @@ -57,7 +57,7 @@ teardown() {
run dolt sql -q "select * from test"
[ "$status" -eq 0 ]
# All row counts are offset by 4 to account for table printing
[ "${#lines[@]}" -eq 7 ]
[ "${#lines[@]}" -eq 7 ]
run dolt sql -q "select * from test where pk='tim'"
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 5 ]
Expand Down Expand Up @@ -102,15 +102,15 @@ teardown() {
dolt sql -q "insert into test (pk) values ('brian')"
run dolt sql -q "select * from test"
[ "$status" -eq 0 ]
# select orders by primary key right now so aaron, brian, tim
# select orders by primary key right now so aaron, brian, tim
[[ "${lines[4]}" =~ "<NULL>" ]] || false
[[ ! "${lines[5]}" =~ "<NULL>" ]] || false
doltselectoutput=$output
run dolt sql -q "select * from test"
[ "$status" -eq 0 ]
[[ "$output" =~ "<NULL>" ]] || false
[ "$output" = "$doltselectoutput" ]
# Make sure we don't get a table with no spaces because that bug was
# Make sure we don't get a table with no spaces because that bug was
# generated when making changes to NULL printing
[[ ! "$output" =~ "|||||" ]] || false
}
Expand Down
2 changes: 1 addition & 1 deletion bats/2pk5cols-ints.bats
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ teardown() {
}

@test "create a table with a schema file and examine repo" {
# Remove the docs, because they will show up in the diff below and break the lines[x] assertions.
# Remove the docs, because they will show up in the diff below and break the lines[x] assertions.
rm LICENSE.md
rm README.md
run dolt ls
Expand Down
2 changes: 1 addition & 1 deletion bats/blame.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ teardown() {

setup_repository() {
stash_current_dolt_user

set_dolt_user "Thomas Foolery", "[email protected]"
dolt sql <<SQL
CREATE TABLE blame_test (
Expand Down
2 changes: 1 addition & 1 deletion bats/config.bats
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ teardown() {

@test "set a user and email and init a repo" {
dolt config --global --add user.name "bats tester"
run dolt init
run dolt init
[ "$status" -eq 1 ]
[[ "$output" =~ "Could not determine user.email" ]] || false
dolt config --global --add user.email "[email protected]"
Expand Down
6 changes: 3 additions & 3 deletions bats/conflict-detection.bats
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ SQL
run dolt merge add-table
[ $status -eq 0 ]
[[ "$output" =~ "Updating" ]] || false
skip "should have a merge summary section that says 1 table changed"
skip "should have a merge summary section that says 1 table changed"
[[ "$output" =~ "1 tables changed" ]] || false
[[ ! "$output" =~ "CONFLICT" ]] || false
}
Expand Down Expand Up @@ -450,7 +450,7 @@ SQL
[[ "$output" =~ "CONFLICT" ]] || false
}

# Altering types and properties of the schema are not really supported by the
# Altering types and properties of the schema are not really supported by the
# command line. Have to upload schema files for these next few tests.
@test "two branches change type of same column to same type. merge. no conflict" {
dolt sql <<SQL
Expand Down Expand Up @@ -551,7 +551,7 @@ SQL
run dolt merge change-types
[ $status -eq 1 ]
[[ "$output" =~ "Bad merge" ]] || false
skip "I think changing a type to two different types should throw a conflict"
skip "I think changing a type to two different types should throw a conflict"
[ $status -eq 0 ]
[[ "$output" =~ "CONFLICT" ]] || false
}
Expand Down
6 changes: 3 additions & 3 deletions bats/create-tables.bats
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ SQL
@test "create a table with json import. no schema." {
run dolt table import -c employees `batshelper employees-tbl.json`
[ "$status" -ne 0 ]
[ "$output" = "Please specify schema file for .json tables." ]
[ "$output" = "Please specify schema file for .json tables." ]
}

@test "create a table with json import. bad json." {
Expand All @@ -149,7 +149,7 @@ SQL
[ "$status" -eq 1 ]
[[ "$output" =~ "Error creating reader" ]] || false
skip "Error message mentions valid table file but not invalid schema file"
# Be careful here. "employees-sch-bad.json" matches. I think it is because
# Be careful here. "employees-sch-bad.json" matches. I think it is because
# the command line is somehow in $output. Added " to" to make it fail.
[[ "$output" =~ "employees-sch-bad.json to" ]] || false
}
Expand Down Expand Up @@ -341,7 +341,7 @@ SQL
[[ "$output" =~ "PRIMARY KEY (\`pk\`)" ]] || false
}


@test "create a table using sql with a string" {
run dolt sql -q "CREATE TABLE test (pk BIGINT NOT NULL, c1 LONGTEXT, PRIMARY KEY (pk))"
[ "$status" -eq 0 ]
Expand Down
8 changes: 4 additions & 4 deletions bats/diff.bats
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ SQL
dolt sql -q "insert into test values (1, 1, 1, 1, 1, 1)"
dolt add test
dolt commit -m "Added another row"
run dolt diff --summary newbranch firstbranch
run dolt diff --summary newbranch firstbranch
[ "$status" -eq 0 ]
[[ "$output" =~ "1 Row Unmodified (100.00%)" ]] || false
[[ "$output" =~ "1 Row Added (100.00%)" ]] || false
Expand Down Expand Up @@ -282,14 +282,14 @@ SQL
dolt commit -m "table created"
dolt sql -q "insert into test values (2, 22, 0, 0, 0, 0)"
dolt sql -q "insert into test values (3, 33, 0, 0, 0, 0)"

run dolt diff --where "poop=0"
[ "$status" -eq 1 ]
[[ "$output" =~ "failed to parse where clause" ]] || false

dolt add test
dolt commit -m "added two rows"

run dolt diff --where "poop=0"
skip "Bad where clause not found because the argument parsing logic is only triggered on existance of a diff"
[ "$status" -eq 1 ]
Expand Down
40 changes: 20 additions & 20 deletions bats/docs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ SQL
[[ "$output" =~ "Untracked files" ]] || false
[[ "$output" =~ ([[:space:]]*new doc:[[:space:]]*README.md) ]] || false
[[ ! "$output" =~ "invalid" ]] || false

run dolt add invalid LICENSE.md
[ "$status" -eq 1 ]
run dolt status
[ "$status" -eq 0 ]
[[ "$output" =~ "Untracked files" ]] || false
[[ "$output" =~ ([[:space:]]*new doc:[[:space:]]*LICENSE.md) ]] || false
[[ ! "$output" =~ "invalid" ]] || false

run dolt add invalid README.md LICENSE.md
[ "$status" -eq 1 ]
run dolt status
Expand All @@ -155,7 +155,7 @@ SQL
}

@test "dolt reset --hard should move doc files to untracked files when there are no doc values on the head commit" {
dolt reset --hard
dolt reset --hard
run dolt status
[ "$status" -eq 0 ]
[[ "$output" =~ "Untracked files" ]] || false
Expand Down Expand Up @@ -191,8 +191,8 @@ SQL
[[ "$output" =~ "nothing to commit, working tree clean" ]] || false
run cat README.md
[ "$output" = readme-text ]


echo newLicenseText > LICENSE.md
dolt sql <<SQL
CREATE TABLE test (
Expand Down Expand Up @@ -228,7 +228,7 @@ SQL
[[ "$output" =~ "Untracked files:" ]] || false
[[ "$output" =~ ([[:space:]]*new doc:[[:space:]]*LICENSE.md) ]] || false
[[ "$output" =~ ([[:space:]]*new doc:[[:space:]]*README.md) ]] || false

dolt add .
dolt commit -m "initial doc commit"
echo ~new-text~ > README.md
Expand All @@ -243,7 +243,7 @@ SQL
[[ "$output" =~ "Changes not staged for commit:" ]] || false
[[ "$output" =~ ([[:space:]]*modified:[[:space:]]*README.md) ]] || false
run cat README.md
[[ "$output" =~ "~new-text~" ]]
[[ "$output" =~ "~new-text~" ]]
}

@test "dolt reset --soft should remove docs from staging area" {
Expand All @@ -257,8 +257,8 @@ SQL
[[ "$output" =~ "Untracked files:" ]] || false
[[ "$output" =~ ([[:space:]]*new doc:[[:space:]]*LICENSE.md) ]] || false
[[ "$output" =~ ([[:space:]]*new doc:[[:space:]]*README.md) ]] || false


dolt add .
dolt commit -m "initial doc commit"
echo ~new-text~ > README.md
Expand All @@ -269,7 +269,7 @@ SQL
[[ "$output" =~ "Changes not staged for commit:" ]] || false
[[ "$output" =~ ([[:space:]]*modified:[[:space:]]*README.md) ]] || false
run cat README.md
[[ "$output" =~ "~new-text~" ]]
[[ "$output" =~ "~new-text~" ]]
}

@test "dolt reset should remove docs from staging area" {
Expand All @@ -294,22 +294,22 @@ SQL
[[ "$output" =~ "Changes not staged for commit:" ]] || false
[[ "$output" =~ ([[:space:]]*modified:[[:space:]]*README.md) ]] || false
run cat README.md
[[ "$output" =~ "~new-text~" ]]
[[ "$output" =~ "~new-text~" ]]
}

@test "dolt reset <doc> should remove doc from staging area" {
dolt add LICENSE.md

run dolt reset dolt_docs
[ "$status" -eq 1 ]
[[ "$output" =~ "'dolt_docs' is not a valid table name" ]] || false

dolt reset LICENSE.md
run dolt status
[ "$status" -eq 0 ]
[[ "$output" =~ "Untracked files:" ]] || false
[[ "$output" =~ ([[:space:]]*new doc:[[:space:]]*LICENSE.md) ]] || false

dolt add .
run dolt reset LICENSE.md invalid
[ "$status" -eq 1 ]
Expand Down Expand Up @@ -380,8 +380,8 @@ SQL
[[ "$output" =~ "this is my license" ]] || false
run cat README.md
[[ "$output" =~ "This is a repository level README" ]] || false


echo "testing-modified-doc" > LICENSE.md
dolt checkout LICENSE.md
run cat LICENSE.md
Expand Down Expand Up @@ -413,7 +413,7 @@ SQL
run dolt status
[ "$status" -eq 0 ]
[[ ! "$output" =~ "README.md" ]] || false
run ls
run ls
[[ ! "$output" =~ "README.md" ]] || false
[[ "$output" =~ "LICENSE.md" ]] || false
}
Expand All @@ -436,7 +436,7 @@ SQL
[[ ! "$output" =~ "LICENSE.md" ]] || false
[[ ! "$output" =~ "test1" ]] || false
[[ "$output" =~ "README.md" ]] || false
run ls
run ls
[[ ! "$output" =~ "LICENSE.md" ]] || false
[[ "$output" =~ "README.md" ]] || false
run cat README.md
Expand Down Expand Up @@ -642,7 +642,7 @@ SQL
[[ ! "$output" =~ "dolt_docs" ]] || false
dolt add .
dolt commit -m "initial doc commits"

run dolt sql -q "show tables"
[ "$status" -eq 0 ]
[[ ! "$output" =~ "dolt_docs" ]] || false
Expand Down Expand Up @@ -732,7 +732,7 @@ SQL
[[ $output =~ "test-b-again branch" ]] || false
dolt add .
dolt commit -m "merge test-b-again with fixed conflicts"

# A merge with auto-resolved conflicts updates the working root. The docs should match the new working root.
dolt checkout test-b-again
echo test-b-one-more-time > README.md
Expand Down
Loading

0 comments on commit a8ee8c3

Please sign in to comment.