44source string
55
66function main() {
7+ test_string::join
78 test_string::truncateWithEllipsis
89 test_string::getFormattedHeader
910 test_string::get KebabCase
@@ -26,6 +27,18 @@ function main() {
2627 test_string::doForEachLine
2728}
2829
30+ function test_string::join() {
31+ test::title " ✅ Testing string::join"
32+
33+ local -a myArray
34+ myArray=(one two 3 four 5)
35+ test::printVars myArray
36+ test::func string::join myArray
37+ test::func string::join myArray separator=' @'
38+ test::func string::join myArray separator=' '
39+ test::func string::join myArray separator=$' \n - '
40+ }
41+
2942function test_string::truncateWithEllipsis() {
3043 test::title " ✅ Testing string::truncateWithEllipsis"
3144
@@ -38,7 +51,7 @@ function test_string::truncateWithEllipsis() {
3851 test::funcWithInPlaceString string::truncateWithEllipsis ' This is a test string' maxLength=1
3952 test::funcWithInPlaceString string::truncateWithEllipsis ' This is a test string' maxLength=2
4053
41- for (( i= 6 ; i>= 0 ; i-- )) ; do
54+ for (( i = 6 ; i >= 0 ; i-- )) ; do
4255 local myString=" ${ESC__FG_BRIGHT_CYAN} a${ESC__FG_BRIGHT_CYAN} b${ESC__FG_BRIGHT_CYAN} c${ESC__FG_BRIGHT_CYAN} d${ESC__FG_BRIGHT_CYAN} e"
4356 string::truncateWithEllipsis myString maxLength=" ${i} "
4457 echo " REPLY=${REPLY} → ${myString} "
@@ -60,13 +73,13 @@ function test_string::getFormattedHeader() {
6073 test_printFormattedHeader " left||" width=50
6174 test_printFormattedHeader " ||right" width=50
6275
63- for (( i= 20 ; i>= 0 ; i-- )) ; do
76+ for (( i = 20 ; i >= 0 ; i-- )) ; do
6477 test_printFormattedHeader " ${ESC__FG_BRIGHT_CYAN} le${ESC__FG_BRIGHT_CYAN} ft|${ESC__FG_BRIGHT_CYAN} middle|ri${ESC__FG_BRIGHT_CYAN} gh${ESC__FG_BRIGHT_CYAN} t" width=" ${i} "
6578 done
66- for (( i= 20 ; i>= 0 ; i-- )) ; do
79+ for (( i = 20 ; i >= 0 ; i-- )) ; do
6780 test_printFormattedHeader " left|middle|right" width=" ${i} " paddingStyle=$' \e [1;34m' paddingStyleReset=$' \e [0m'
6881 done
69- for (( i= 20 ; i>= 0 ; i-- )) ; do
82+ for (( i = 20 ; i >= 0 ; i-- )) ; do
7083 test_printFormattedHeader " left|middle|right" width=" ${i} " noEllipsis=true
7184 done
7285
@@ -250,7 +263,7 @@ function test_string::wrapWords() {
250263function test_string::wrapCharacters() {
251264 test::title " ✅ Testing string::wrapCharacters"
252265
253- test::markdown " Wrapping characters at column 20 with padding of 3 on all lines"
266+ test::markdown " Wrapping characters at column 20 with padding of 3 on all lines"
254267 test::func string::wrapCharacters MULTI_LINES_TEXT width=20 newLinePadString=" " firstLineWidth=17
255268
256269 test::markdown " Wrapping characters at 20, no other options"
@@ -347,4 +360,4 @@ MULTI_LINES_TEXT3="1 line one
3473603 line three
3483614 line four"
349362
350- main
363+ main
0 commit comments