Fossil SCM

Enhance the 'test-comment-format' test command.

mistachkin 2014-06-19 00:47 trunk
Commit 6a3b39a06be586f6881b79007738a04c9c27c2fe
1 file changed +17 -6
+17 -6
--- src/comformat.c
+++ src/comformat.c
@@ -134,13 +134,24 @@
134134
** Test the comment printing
135135
**
136136
** COMMAND: test-comment-format
137137
*/
138138
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);
142155
}
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));
146157
}
147158
--- 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

Keyboard Shortcuts

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