mirror of
https://github.com/sagiegurari/duckscript
synced 2024-09-15 22:19:51 +00:00
49 lines
793 B
Plaintext
49 lines
793 B
Plaintext
|
|
fn test_empty_with_range
|
|
output = substring "" 0 0
|
|
|
|
assert_eq ${output} "false"
|
|
end
|
|
|
|
fn test_text_with_empty_range
|
|
output = substring "test" 0 0
|
|
|
|
assert_eq ${output} ""
|
|
end
|
|
|
|
fn test_text_with_range
|
|
output = substring "test" 1 3
|
|
|
|
assert_eq ${output} "es"
|
|
end
|
|
|
|
fn test_text_with_start
|
|
output = substring "test" 1
|
|
|
|
assert_eq ${output} "est"
|
|
end
|
|
|
|
fn test_text_with_end
|
|
output = substring "test" -2
|
|
|
|
assert_eq ${output} "te"
|
|
end
|
|
|
|
fn test_text_with_range_and_start_too_big
|
|
output = substring "test" 6 8
|
|
|
|
assert_eq ${output} "false"
|
|
end
|
|
|
|
fn test_text_with_start_too_big
|
|
output = substring "test" 6
|
|
|
|
assert_eq ${output} "false"
|
|
end
|
|
|
|
fn test_text_with_range_and_end_too_big
|
|
output = substring "test" 0 8
|
|
|
|
assert_eq ${output} "false"
|
|
end
|