Fossil SCM

Add --trimspace option to the 'test-comment-format' test command.

mistachkin 2014-06-21 01:38 experimental
Commit 4e3f915c00e06b6c7d0566a24f140d567a4026f7
2 files changed +5 -1 +2 -2
+5 -1
--- src/comformat.c
+++ src/comformat.c
@@ -340,20 +340,24 @@
340340
**
341341
** Options:
342342
** --decode Decode the text using the same method used when
343343
** handling the value of a C-card from a manifest.
344344
** --legacy Use the legacy comment printing algorithm.
345
+** --trimspace Enable trimming of leading/trailing spaces.
345346
** --wordbreak Attempt to break lines on word boundaries.
346347
*/
347348
void test_comment_format(void){
348349
const char *zPrefix;
349350
char *zText;
350351
int indent, width;
351352
int decode = find_option("decode", 0, 0)!=0;
352
- int flags = COMMENT_PRINT_DEFAULT;
353
+ int flags = COMMENT_PRINT_NONE;
353354
if( find_option("legacy", 0, 0) ){
354355
flags |= COMMENT_PRINT_LEGACY;
356
+ }
357
+ if( find_option("trimspace", 0, 0) ){
358
+ flags |= COMMENT_PRINT_TRIM_SPACE;
355359
}
356360
if( find_option("wordbreak", 0, 0) ){
357361
flags |= COMMENT_PRINT_WORD_BREAK;
358362
}
359363
if( g.argc!=4 && g.argc!=5 ){
360364
--- 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
--- test/comment.test
+++ test/comment.test
@@ -56,16 +56,16 @@
5656
fossil test-comment-format --decode "" "this\\sis\\sa\\sshort\\scomment." 26
5757
test comment-8 {$RESULT eq "this is a short comment.\n(1 lines output)"}
5858
5959
###############################################################################
6060
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
6262
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)"}
6363
6464
###############################################################################
6565
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
6767
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)"}
6868
6969
###############################################################################
7070
7171
fossil test-comment-format "HH:MM:SS " "....................................................................................*" 78
7272
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button