aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2025-07-12 12:10:23 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2025-07-12 12:13:08 -0400
commit870904f2c3d7830aea32c3b735b42220155ff213 (patch)
treed986b2b9d252adb84eb0b542a36f6737a05eb09a /tests
parentFix word wrapping to next line when the word is longer than the buffer (diff)
downloadcli-870904f2c3d7830aea32c3b735b42220155ff213.zip
Add additional test spanning multiple lines
Diffstat (limited to 'tests')
-rw-r--r--tests/justify.bats14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/justify.bats b/tests/justify.bats
index 73db029..806ea81 100644
--- a/tests/justify.bats
+++ b/tests/justify.bats
@@ -57,7 +57,7 @@ EOF
assert_output "Hello world"
}
-@test "word longer than buffer is wrapped" {
+@test "word longer than buffer is wrapped to next line" {
run "${JUSTIFY_BIN}" -w 60 <<EOF
123456789012345678901234567890123456789012345678901234567890EXTRA
EOF
@@ -67,6 +67,18 @@ EXTRA"
assert_output "$expected_output"
}
+@test "word longer than buffer is wrapped across multiple lines" {
+ run "${JUSTIFY_BIN}" -w 20 <<EOF
+verylongwordthatdoesnotfitinasinglelineandshouldbesplitacrossmultiplelines
+EOF
+ assert_success
+ expected_output="verylongwordthatdoes
+notfitinasinglelinea
+ndshouldbesplitacros
+smultiplelines"
+ assert_output "$expected_output"
+}
+
@test "multiple spaces in input are collapsed when on last left-aligned line" {
run "${JUSTIFY_BIN}" <<EOF
This is spaced