Add vinai's changes

This commit is contained in:
Max Hoffman
2021-03-10 08:59:37 -08:00
parent 73e7493144
commit 64664ec26b
2 changed files with 16 additions and 39 deletions

View File

@@ -1,39 +0,0 @@
#!/usr/bin/env bats
load $BATS_TEST_DIRNAME/helper/common.bash
setup() {
setup_common
dolt sql <<SQL
CREATE TABLE test (
pk int primary key
);
CREATE TABLE test2 (
pk int primary key
);
INSERT INTO test VALUES (0),(1),(2);
SQL
}
teardown() {
assert_feature_version
teardown_common
}
@test "active_branch() func" {
run dolt sql -q 'select active_branch()' -r csv
[ $status -eq 0 ]
# TODO: Get rid of this echo.
echo $output
[[ "$output" =~ "ACTIVE_BRANCH()" ]] || false
[[ "$output" =~ "master" ]] || false
}
@test "active_branch() func on feature branch" {
run dolt branch tmp_br
run dolt checkout tmp_br
run dolt sql -q 'select active_branch()' -r csv
[ $status -eq 0 ]
[[ "$output" =~ "ACTIVE_BRANCH()" ]] || false
[[ "$output" =~ "tmp_br" ]] || false
}

View File

@@ -946,3 +946,19 @@ SQL
[[ ! "$output" =~ ',p2,PROCEDURE,' ]] || false
[[ "${#lines[@]}" = "1" ]] || false
}
@test "sql: active_branch() func" {
run dolt sql -q 'select active_branch()' -r csv
[ $status -eq 0 ]
[[ "$output" =~ "ACTIVE_BRANCH()" ]] || false
[[ "$output" =~ "master" ]] || false
}
@test "sql: active_branch() func on feature branch" {
run dolt branch tmp_br
run dolt checkout tmp_br
run dolt sql -q 'select active_branch()' -r csv
[ $status -eq 0 ]
[[ "$output" =~ "ACTIVE_BRANCH()" ]] || false
[[ "$output" =~ "tmp_br" ]] || false
}