Fossil SCM
Add --trimspace option to the 'test-comment-format' test command.
Commit
4e3f915c00e06b6c7d0566a24f140d567a4026f7
Parent
0463c7bfb1a9980…
2 files changed
+5
-1
+2
-2
+5
-1
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -340,20 +340,24 @@ | ||
| 340 | 340 | ** |
| 341 | 341 | ** Options: |
| 342 | 342 | ** --decode Decode the text using the same method used when |
| 343 | 343 | ** handling the value of a C-card from a manifest. |
| 344 | 344 | ** --legacy Use the legacy comment printing algorithm. |
| 345 | +** --trimspace Enable trimming of leading/trailing spaces. | |
| 345 | 346 | ** --wordbreak Attempt to break lines on word boundaries. |
| 346 | 347 | */ |
| 347 | 348 | void test_comment_format(void){ |
| 348 | 349 | const char *zPrefix; |
| 349 | 350 | char *zText; |
| 350 | 351 | int indent, width; |
| 351 | 352 | int decode = find_option("decode", 0, 0)!=0; |
| 352 | - int flags = COMMENT_PRINT_DEFAULT; | |
| 353 | + int flags = COMMENT_PRINT_NONE; | |
| 353 | 354 | if( find_option("legacy", 0, 0) ){ |
| 354 | 355 | flags |= COMMENT_PRINT_LEGACY; |
| 356 | + } | |
| 357 | + if( find_option("trimspace", 0, 0) ){ | |
| 358 | + flags |= COMMENT_PRINT_TRIM_SPACE; | |
| 355 | 359 | } |
| 356 | 360 | if( find_option("wordbreak", 0, 0) ){ |
| 357 | 361 | flags |= COMMENT_PRINT_WORD_BREAK; |
| 358 | 362 | } |
| 359 | 363 | if( g.argc!=4 && g.argc!=5 ){ |
| 360 | 364 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -340,20 +340,24 @@ | |
| 340 | ** |
| 341 | ** Options: |
| 342 | ** --decode Decode the text using the same method used when |
| 343 | ** handling the value of a C-card from a manifest. |
| 344 | ** --legacy Use the legacy comment printing algorithm. |
| 345 | ** --wordbreak Attempt to break lines on word boundaries. |
| 346 | */ |
| 347 | void test_comment_format(void){ |
| 348 | const char *zPrefix; |
| 349 | char *zText; |
| 350 | int indent, width; |
| 351 | int decode = find_option("decode", 0, 0)!=0; |
| 352 | int flags = COMMENT_PRINT_DEFAULT; |
| 353 | if( find_option("legacy", 0, 0) ){ |
| 354 | flags |= COMMENT_PRINT_LEGACY; |
| 355 | } |
| 356 | if( find_option("wordbreak", 0, 0) ){ |
| 357 | flags |= COMMENT_PRINT_WORD_BREAK; |
| 358 | } |
| 359 | if( g.argc!=4 && g.argc!=5 ){ |
| 360 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -340,20 +340,24 @@ | |
| 340 | ** |
| 341 | ** Options: |
| 342 | ** --decode Decode the text using the same method used when |
| 343 | ** handling the value of a C-card from a manifest. |
| 344 | ** --legacy Use the legacy comment printing algorithm. |
| 345 | ** --trimspace Enable trimming of leading/trailing spaces. |
| 346 | ** --wordbreak Attempt to break lines on word boundaries. |
| 347 | */ |
| 348 | void test_comment_format(void){ |
| 349 | const char *zPrefix; |
| 350 | char *zText; |
| 351 | int indent, width; |
| 352 | int decode = find_option("decode", 0, 0)!=0; |
| 353 | int flags = COMMENT_PRINT_NONE; |
| 354 | if( find_option("legacy", 0, 0) ){ |
| 355 | flags |= COMMENT_PRINT_LEGACY; |
| 356 | } |
| 357 | if( find_option("trimspace", 0, 0) ){ |
| 358 | flags |= COMMENT_PRINT_TRIM_SPACE; |
| 359 | } |
| 360 | if( find_option("wordbreak", 0, 0) ){ |
| 361 | flags |= COMMENT_PRINT_WORD_BREAK; |
| 362 | } |
| 363 | if( g.argc!=4 && g.argc!=5 ){ |
| 364 |
+2
-2
| --- test/comment.test | ||
| +++ test/comment.test | ||
| @@ -56,16 +56,16 @@ | ||
| 56 | 56 | fossil test-comment-format --decode "" "this\\sis\\sa\\sshort\\scomment." 26 |
| 57 | 57 | test comment-8 {$RESULT eq "this is a short comment.\n(1 lines output)"} |
| 58 | 58 | |
| 59 | 59 | ############################################################################### |
| 60 | 60 | |
| 61 | -fossil test-comment-format --decode "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly." 78 | |
| 61 | +fossil test-comment-format --decode --trimspace "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly." 78 | |
| 62 | 62 | test comment-9 {$RESULT eq "HH:MM:SS this is a long comment that should span multiple lines if the test is\n working correctly.\n(2 lines output)"} |
| 63 | 63 | |
| 64 | 64 | ############################################################################### |
| 65 | 65 | |
| 66 | -fossil test-comment-format --decode "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly. more text here describing the issue.\\nanother line here..................................................................................*" 78 | |
| 66 | +fossil test-comment-format --decode --trimspace "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly. more text here describing the issue.\\nanother line here..................................................................................*" 78 | |
| 67 | 67 | test comment-10 {$RESULT eq "HH:MM:SS this is a long comment that should span multiple lines if the test is\n working correctly. more text here describing the issue.\n another line here....................................................\n ..............................*\n(4 lines output)"} |
| 68 | 68 | |
| 69 | 69 | ############################################################################### |
| 70 | 70 | |
| 71 | 71 | fossil test-comment-format "HH:MM:SS " "....................................................................................*" 78 |
| 72 | 72 |
| --- test/comment.test | |
| +++ test/comment.test | |
| @@ -56,16 +56,16 @@ | |
| 56 | fossil test-comment-format --decode "" "this\\sis\\sa\\sshort\\scomment." 26 |
| 57 | test comment-8 {$RESULT eq "this is a short comment.\n(1 lines output)"} |
| 58 | |
| 59 | ############################################################################### |
| 60 | |
| 61 | fossil test-comment-format --decode "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly." 78 |
| 62 | test comment-9 {$RESULT eq "HH:MM:SS this is a long comment that should span multiple lines if the test is\n working correctly.\n(2 lines output)"} |
| 63 | |
| 64 | ############################################################################### |
| 65 | |
| 66 | fossil test-comment-format --decode "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly. more text here describing the issue.\\nanother line here..................................................................................*" 78 |
| 67 | test comment-10 {$RESULT eq "HH:MM:SS this is a long comment that should span multiple lines if the test is\n working correctly. more text here describing the issue.\n another line here....................................................\n ..............................*\n(4 lines output)"} |
| 68 | |
| 69 | ############################################################################### |
| 70 | |
| 71 | fossil test-comment-format "HH:MM:SS " "....................................................................................*" 78 |
| 72 |
| --- test/comment.test | |
| +++ test/comment.test | |
| @@ -56,16 +56,16 @@ | |
| 56 | fossil test-comment-format --decode "" "this\\sis\\sa\\sshort\\scomment." 26 |
| 57 | test comment-8 {$RESULT eq "this is a short comment.\n(1 lines output)"} |
| 58 | |
| 59 | ############################################################################### |
| 60 | |
| 61 | fossil test-comment-format --decode --trimspace "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly." 78 |
| 62 | test comment-9 {$RESULT eq "HH:MM:SS this is a long comment that should span multiple lines if the test is\n working correctly.\n(2 lines output)"} |
| 63 | |
| 64 | ############################################################################### |
| 65 | |
| 66 | fossil test-comment-format --decode --trimspace "HH:MM:SS " "this is a long comment that should span multiple lines if the test is working correctly. more text here describing the issue.\\nanother line here..................................................................................*" 78 |
| 67 | test comment-10 {$RESULT eq "HH:MM:SS this is a long comment that should span multiple lines if the test is\n working correctly. more text here describing the issue.\n another line here....................................................\n ..............................*\n(4 lines output)"} |
| 68 | |
| 69 | ############################################################################### |
| 70 | |
| 71 | fossil test-comment-format "HH:MM:SS " "....................................................................................*" 78 |
| 72 |