aboutsummaryrefslogtreecommitdiffstats
path: root/tests/justify.bats
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2025-10-11 14:19:39 -0400
committerEugene Triguba <hello@eugenetriguba.com>2025-10-11 14:31:37 -0400
commitd3ec525b7d6ecd8de064d3f3a54d112769d1d3b3 (patch)
tree935b51f95afb513604c82c9e1efca223af60c109 /tests/justify.bats
parentFix git clone link in readme (diff)
downloadcli-d3ec525b7d6ecd8de064d3f3a54d112769d1d3b3.zip
Add unicode support to justify
Diffstat (limited to 'tests/justify.bats')
-rw-r--r--tests/justify.bats39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/justify.bats b/tests/justify.bats
index 806ea81..525c5d8 100644
--- a/tests/justify.bats
+++ b/tests/justify.bats
@@ -94,3 +94,42 @@ EOF
assert_success
assert_output ""
}
+
+@test "unicode text with accented characters is justified correctly" {
+ run "${JUSTIFY_BIN}" -w 30 <<EOF
+café résumé naïve Zürich another word
+EOF
+ assert_success
+ expected_output="café résumé naïve Zürich
+another word"
+ assert_output "$expected_output"
+}
+
+@test "unicode text with CJK characters is justified correctly" {
+ run "${JUSTIFY_BIN}" -w 20 <<EOF
+Hello 世界 test this is a longer line
+EOF
+ assert_success
+ expected_output="Hello 世界 test this
+is a longer line"
+ assert_output "$expected_output"
+}
+
+@test "mixed ASCII and unicode text wraps correctly" {
+ run "${JUSTIFY_BIN}" -w 25 <<EOF
+This is café and résumé text that should wrap properly
+EOF
+ assert_success
+ expected_output="This is café and résumé
+text that should wrap
+properly"
+ assert_output "$expected_output"
+}
+
+@test "unicode text on last line is left-aligned" {
+ run "${JUSTIFY_BIN}" <<EOF
+café résumé
+EOF
+ assert_success
+ assert_output "café résumé"
+}