Add additional bats tests to ensure we return helpful errors when using features that are unsupported on the old-format (instead of panicking)

This commit is contained in:
Nick Tobey
2023-04-25 10:47:23 -07:00
parent f747aedcae
commit 0ab355aa1f
+30
View File
@@ -123,6 +123,7 @@ assert_has_key_value() {
}
@test "show: --no-pretty" {
skip_nbf_ld_1
dolt commit --allow-empty -m "commit: initialize table1"
run dolt show --no-pretty
[ $status -eq 0 ]
@@ -140,6 +141,7 @@ assert_has_key_value() {
}
@test "show: HEAD root" {
skip_nbf_ld_1
dolt sql -q "create table table1 (pk int PRIMARY KEY)"
dolt sql -q "insert into table1 values (1), (2), (3)"
dolt add .
@@ -162,6 +164,7 @@ assert_has_key_value() {
}
@test "show: WORKING" {
skip_nbf_ld_1
dolt sql -q "create table table1 (pk int PRIMARY KEY)"
dolt sql -q "insert into table1 values (1), (2), (3)"
dolt add .
@@ -179,6 +182,7 @@ assert_has_key_value() {
}
@test "show: STAGED" {
skip_nbf_ld_1
dolt sql -q "create table table1 (pk int PRIMARY KEY)"
dolt sql -q "insert into table1 values (1), (2), (3)"
dolt add .
@@ -196,6 +200,7 @@ assert_has_key_value() {
}
@test "show: table" {
skip_nbf_ld_1
dolt sql -q "create table table1 (pk int PRIMARY KEY)"
dolt sql -q "insert into table1 values (1), (2), (3)"
dolt add .
@@ -218,6 +223,7 @@ assert_has_key_value() {
}
@test "show: pretty commit from hash" {
skip_nbf_ld_1
dolt tag v0
dolt commit --allow-empty -m "commit1"
@@ -227,3 +233,27 @@ assert_has_key_value() {
run dolt show "$parentHash"
[[ "$output" =~ "tag: v0" ]] || false
}
@test "show: --no-pretty with old format" {
skip_nbf_dolt
run dolt show --no-pretty
[ $status -eq 1 ]
[[ "$output" =~ "dolt show --no-pretty is not supported when using old LD_1 storage format." ]] || false
}
@test "show: non-commit object with old format" {
skip_nbf_dolt
run dolt show WORKING
[ $status -eq 1 ]
[[ "$output" =~ "dolt show cannot show non-commit objects when using the old LD_1 storage format: WORKING is not a commit" ]] || false
}
@test "show: non-existent branch" {
skip_nbf_dolt
run dolt show branch1
[ $status -eq 1 ]
[[ "$output" =~ "branch not found: branch1" ]] || false
}