Fossil SCM
Enhance the 'test-comment-format' test command.
Commit
6a3b39a06be586f6881b79007738a04c9c27c2fe
Parent
54cc57e7a34785a…
1 file changed
+17
-6
+17
-6
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -134,13 +134,24 @@ | ||
| 134 | 134 | ** Test the comment printing |
| 135 | 135 | ** |
| 136 | 136 | ** COMMAND: test-comment-format |
| 137 | 137 | */ |
| 138 | 138 | void test_comment_format(void){ |
| 139 | - int indent; | |
| 140 | - if( g.argc!=4 ){ | |
| 141 | - usage("PREFIX TEXT"); | |
| 139 | + const char *zPrefix; | |
| 140 | + const char *zText; | |
| 141 | + int indent, width; | |
| 142 | + if( g.argc!=4 && g.argc!=5 ){ | |
| 143 | + usage("PREFIX TEXT ?WIDTH?"); | |
| 144 | + } | |
| 145 | + zPrefix = g.argv[2]; | |
| 146 | + zText = g.argv[3]; | |
| 147 | + indent = strlen(zPrefix); | |
| 148 | + if( g.argc==5 ){ | |
| 149 | + width = atoi(g.argv[4]); | |
| 150 | + }else{ | |
| 151 | + width = -1; /* automatic */ | |
| 152 | + } | |
| 153 | + if( indent>0 ){ | |
| 154 | + fossil_print("%s", zPrefix); | |
| 142 | 155 | } |
| 143 | - indent = strlen(g.argv[2]) + 1; | |
| 144 | - fossil_print("%s ", g.argv[2]); | |
| 145 | - fossil_print("(%d lines output)\n", comment_print(g.argv[3], indent, 79)); | |
| 156 | + fossil_print("(%d lines output)\n", comment_print(zText, indent, width)); | |
| 146 | 157 | } |
| 147 | 158 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -134,13 +134,24 @@ | |
| 134 | ** Test the comment printing |
| 135 | ** |
| 136 | ** COMMAND: test-comment-format |
| 137 | */ |
| 138 | void test_comment_format(void){ |
| 139 | int indent; |
| 140 | if( g.argc!=4 ){ |
| 141 | usage("PREFIX TEXT"); |
| 142 | } |
| 143 | indent = strlen(g.argv[2]) + 1; |
| 144 | fossil_print("%s ", g.argv[2]); |
| 145 | fossil_print("(%d lines output)\n", comment_print(g.argv[3], indent, 79)); |
| 146 | } |
| 147 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -134,13 +134,24 @@ | |
| 134 | ** Test the comment printing |
| 135 | ** |
| 136 | ** COMMAND: test-comment-format |
| 137 | */ |
| 138 | void test_comment_format(void){ |
| 139 | const char *zPrefix; |
| 140 | const char *zText; |
| 141 | int indent, width; |
| 142 | if( g.argc!=4 && g.argc!=5 ){ |
| 143 | usage("PREFIX TEXT ?WIDTH?"); |
| 144 | } |
| 145 | zPrefix = g.argv[2]; |
| 146 | zText = g.argv[3]; |
| 147 | indent = strlen(zPrefix); |
| 148 | if( g.argc==5 ){ |
| 149 | width = atoi(g.argv[4]); |
| 150 | }else{ |
| 151 | width = -1; /* automatic */ |
| 152 | } |
| 153 | if( indent>0 ){ |
| 154 | fossil_print("%s", zPrefix); |
| 155 | } |
| 156 | fossil_print("(%d lines output)\n", comment_print(zText, indent, width)); |
| 157 | } |
| 158 |