Skip to content

Commit

Permalink
Bats test
Browse files Browse the repository at this point in the history
  • Loading branch information
zachmu committed Oct 12, 2024
1 parent dfefb06 commit ad154f1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions integration-tests/bats/checkout.bats
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,30 @@ SQL
[[ "$output" =~ "foreign_key1" ]] || false
}

@test "checkout: dolt checkout table from another branch" {
dolt sql -q "create table t (c1 int primary key, c2 int, check(c2 > 0))"
dolt sql -q "create table z (c1 int primary key, c2 int)"
dolt sql -q "insert into t values (1,1)"
dolt sql -q "insert into z values (2,2);"
dolt commit -Am "new values in t"
dolt branch b1
dolt sql -q "insert into t values (3,3);"
dolt sql -q "insert into z values (4,4);"
dolt checkout b1 -- t

dolt status
run dolt status
[[ "$output" =~ "On branch main" ]] || false
[[ "$output" =~ "modified: z" ]] || false
[[ ! "$output" =~ "modified: t" ]] || false

run dolt sql -q "select count(*) from t" -r csv
[[ "$output" =~ "1" ]] || false

run dolt sql -q "select count(*) from z" -r csv
[[ "$output" =~ "2" ]] || false
}

@test "checkout: with -f flag without conflict" {
dolt sql -q 'create table test (id int primary key);'
dolt sql -q 'insert into test (id) values (8);'
Expand Down

0 comments on commit ad154f1

Please sign in to comment.