Skip to content

Commit 7dc484a

Browse files
committed
tests 12
Signed-off-by: Julio Jimenez <julio@clickhouse.com>
1 parent 9fcd51b commit 7dc484a

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

test/simple.bats

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,14 @@ EOF
674674
[[ "$output" == "test_database" ]]
675675
}
676676

677+
# Test 73a: sanitize_email removes newlines from input
678+
@test "sanitize_email removes newlines from input" {
679+
run sanitize_email "user@example.com\n" # Just a trailing newline
680+
[ "$status" -eq 0 ]
681+
[[ "$output" == "user@example.com" ]]
682+
[[ "$output" != *$'\n'* ]]
683+
}
684+
677685
# Test 74: sanitize_database_name accepts name with underscores
678686
@test "sanitize_database_name accepts name starting with underscore" {
679687
run sanitize_database_name "_test_database"
@@ -800,6 +808,13 @@ EOF
800808
[[ "$output" == *"Numeric value for TEST_FIELD out of range"* ]]
801809
}
802810

811+
# Test 91: sanitize_numeric rejects number above maximum
812+
@test "sanitize_numeric rejects number above maximum" {
813+
run sanitize_numeric "150" "TEST_FIELD" 10 100
814+
[ "$status" -eq 1 ]
815+
[[ "$output" == *"Numeric value for TEST_FIELD out of range"* ]]
816+
}
817+
803818
# Test 92: sanitize_numeric accepts boundary values
804819
@test "sanitize_numeric accepts boundary values" {
805820
run sanitize_numeric "10" "TEST_FIELD" 10 100
@@ -811,10 +826,9 @@ EOF
811826
[[ "$output" == "100" ]]
812827
}
813828

814-
# Test 93: sanitize_email removes newlines from input
815-
@test "sanitize_email removes newlines from input" {
816-
run sanitize_email "user@example.com\n" # Just a trailing newline
817-
[ "$status" -eq 0 ]
818-
[[ "$output" == "user@example.com" ]]
819-
[[ "$output" != *$'\n'* ]]
820-
}
829+
# Test 93: sanitize_numeric rejects empty input
830+
@test "sanitize_numeric rejects empty input" {
831+
run sanitize_numeric "" "TEST_FIELD"
832+
[ "$status" -eq 1 ]
833+
[[ "$output" == *"Invalid numeric value for TEST_FIELD"* ]]
834+
}

0 commit comments

Comments
 (0)