Fossil SCM
For the new comment printing algorithm, make sure to indent after forcing a line break due to the original comment text being detected.
Commit
856c60611ff37bdbb1899ecd746d4ab16998f807
Parent
b000db4752f9145…
2 files changed
+23
-6
+22
-2
+23
-6
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -121,11 +121,14 @@ | ||
| 121 | 121 | ** a new line -OR- runs out of space on the logical line. |
| 122 | 122 | */ |
| 123 | 123 | static void comment_print_line( |
| 124 | 124 | const char *zOrigText, /* [in] Original comment text ONLY, may be NULL. */ |
| 125 | 125 | const char *zLine, /* [in] The comment line to print. */ |
| 126 | - int indent, /* [in] Number of spaces to indent, zero for none. */ | |
| 126 | + int origIndent, /* [in] Number of spaces to indent before the original | |
| 127 | + ** comment. */ | |
| 128 | + int indent, /* [in] Number of spaces to indent, before the line | |
| 129 | + ** to print. */ | |
| 127 | 130 | int lineChars, /* [in] Maximum number of characters to print. */ |
| 128 | 131 | int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */ |
| 129 | 132 | int wordBreak, /* [in] Non-zero to try breaking on word boundaries. */ |
| 130 | 133 | int origBreak, /* [in] Non-zero to break before original comment. */ |
| 131 | 134 | int *pLineCnt, /* [in/out] Pointer to the total line count. */ |
| @@ -140,11 +143,13 @@ | ||
| 140 | 143 | char c = zLine[index]; |
| 141 | 144 | if( c==0 ){ |
| 142 | 145 | break; |
| 143 | 146 | }else{ |
| 144 | 147 | if( origBreak && index>0 ){ |
| 145 | - if( comment_check_orig(zOrigText, &zLine[index], &charCnt, &lineCnt) ){ | |
| 148 | + const char *zCurrent = &zLine[index]; | |
| 149 | + if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){ | |
| 150 | + comment_print_indent(zCurrent, origIndent, trimSpace, &index); | |
| 146 | 151 | maxChars = lineChars; |
| 147 | 152 | } |
| 148 | 153 | } |
| 149 | 154 | index++; |
| 150 | 155 | } |
| @@ -383,12 +388,13 @@ | ||
| 383 | 388 | lineCnt++; |
| 384 | 389 | return lineCnt; |
| 385 | 390 | } |
| 386 | 391 | zLine = zText; |
| 387 | 392 | for(;;){ |
| 388 | - comment_print_line(zOrigText, zLine, zLine>zText ? indent : 0, maxChars, | |
| 389 | - trimSpace, wordBreak, origBreak, &lineCnt, &zLine); | |
| 393 | + comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0, | |
| 394 | + maxChars, trimSpace, wordBreak, origBreak, &lineCnt, | |
| 395 | + &zLine); | |
| 390 | 396 | if( !zLine || !zLine[0] ) break; |
| 391 | 397 | } |
| 392 | 398 | return lineCnt; |
| 393 | 399 | } |
| 394 | 400 | |
| @@ -408,15 +414,18 @@ | ||
| 408 | 414 | ** --legacy Use the legacy comment printing algorithm. |
| 409 | 415 | ** --trimspace Enable trimming of leading/trailing spaces. |
| 410 | 416 | ** --wordbreak Attempt to break lines on word boundaries. |
| 411 | 417 | ** --origbreak Attempt to break when the original comment text |
| 412 | 418 | ** is detected. |
| 419 | +** --indent Number of spaces to indent (default (-1) is to | |
| 420 | +** auto-detect). Zero means no indent. | |
| 413 | 421 | ** -W|--width <num> Width of lines (default (-1) is to auto-detect). |
| 414 | 422 | ** Zero means no limit. |
| 415 | 423 | */ |
| 416 | 424 | void test_comment_format(void){ |
| 417 | 425 | const char *zWidth; |
| 426 | + const char *zIndent; | |
| 418 | 427 | const char *zPrefix; |
| 419 | 428 | char *zText; |
| 420 | 429 | char *zOrigText; |
| 421 | 430 | int indent, width; |
| 422 | 431 | int fromFile = find_option("file", 0, 0)!=0; |
| @@ -437,10 +446,16 @@ | ||
| 437 | 446 | zWidth = find_option("width","W",1); |
| 438 | 447 | if( zWidth ){ |
| 439 | 448 | width = atoi(zWidth); |
| 440 | 449 | }else{ |
| 441 | 450 | width = -1; /* automatic */ |
| 451 | + } | |
| 452 | + zIndent = find_option("indent",0,1); | |
| 453 | + if( zIndent ){ | |
| 454 | + indent = atoi(zIndent); | |
| 455 | + }else{ | |
| 456 | + indent = -1; /* automatic */ | |
| 442 | 457 | } |
| 443 | 458 | if( g.argc!=4 && g.argc!=5 ){ |
| 444 | 459 | usage("?OPTIONS? PREFIX TEXT ?ORIGTEXT?"); |
| 445 | 460 | } |
| 446 | 461 | zPrefix = g.argv[2]; |
| @@ -467,14 +482,16 @@ | ||
| 467 | 482 | if( zOrigText ){ |
| 468 | 483 | zOrigText = mprintf(fromFile ? "%z" : "%s", zOrigText); |
| 469 | 484 | defossilize(zOrigText); |
| 470 | 485 | } |
| 471 | 486 | } |
| 472 | - indent = strlen(zPrefix); | |
| 473 | - if( indent>0 ){ | |
| 487 | + if( indent<0 ){ | |
| 488 | + indent = strlen(zPrefix); | |
| 489 | + } | |
| 490 | + if( zPrefix && *zPrefix ){ | |
| 474 | 491 | fossil_print("%s", zPrefix); |
| 475 | 492 | } |
| 476 | 493 | fossil_print("(%d lines output)\n", |
| 477 | 494 | comment_print(zText, zOrigText, indent, width, flags)); |
| 478 | 495 | if( zOrigText && zOrigText!=g.argv[4] ) fossil_free(zOrigText); |
| 479 | 496 | if( zText && zText!=g.argv[3] ) fossil_free(zText); |
| 480 | 497 | } |
| 481 | 498 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -121,11 +121,14 @@ | |
| 121 | ** a new line -OR- runs out of space on the logical line. |
| 122 | */ |
| 123 | static void comment_print_line( |
| 124 | const char *zOrigText, /* [in] Original comment text ONLY, may be NULL. */ |
| 125 | const char *zLine, /* [in] The comment line to print. */ |
| 126 | int indent, /* [in] Number of spaces to indent, zero for none. */ |
| 127 | int lineChars, /* [in] Maximum number of characters to print. */ |
| 128 | int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */ |
| 129 | int wordBreak, /* [in] Non-zero to try breaking on word boundaries. */ |
| 130 | int origBreak, /* [in] Non-zero to break before original comment. */ |
| 131 | int *pLineCnt, /* [in/out] Pointer to the total line count. */ |
| @@ -140,11 +143,13 @@ | |
| 140 | char c = zLine[index]; |
| 141 | if( c==0 ){ |
| 142 | break; |
| 143 | }else{ |
| 144 | if( origBreak && index>0 ){ |
| 145 | if( comment_check_orig(zOrigText, &zLine[index], &charCnt, &lineCnt) ){ |
| 146 | maxChars = lineChars; |
| 147 | } |
| 148 | } |
| 149 | index++; |
| 150 | } |
| @@ -383,12 +388,13 @@ | |
| 383 | lineCnt++; |
| 384 | return lineCnt; |
| 385 | } |
| 386 | zLine = zText; |
| 387 | for(;;){ |
| 388 | comment_print_line(zOrigText, zLine, zLine>zText ? indent : 0, maxChars, |
| 389 | trimSpace, wordBreak, origBreak, &lineCnt, &zLine); |
| 390 | if( !zLine || !zLine[0] ) break; |
| 391 | } |
| 392 | return lineCnt; |
| 393 | } |
| 394 | |
| @@ -408,15 +414,18 @@ | |
| 408 | ** --legacy Use the legacy comment printing algorithm. |
| 409 | ** --trimspace Enable trimming of leading/trailing spaces. |
| 410 | ** --wordbreak Attempt to break lines on word boundaries. |
| 411 | ** --origbreak Attempt to break when the original comment text |
| 412 | ** is detected. |
| 413 | ** -W|--width <num> Width of lines (default (-1) is to auto-detect). |
| 414 | ** Zero means no limit. |
| 415 | */ |
| 416 | void test_comment_format(void){ |
| 417 | const char *zWidth; |
| 418 | const char *zPrefix; |
| 419 | char *zText; |
| 420 | char *zOrigText; |
| 421 | int indent, width; |
| 422 | int fromFile = find_option("file", 0, 0)!=0; |
| @@ -437,10 +446,16 @@ | |
| 437 | zWidth = find_option("width","W",1); |
| 438 | if( zWidth ){ |
| 439 | width = atoi(zWidth); |
| 440 | }else{ |
| 441 | width = -1; /* automatic */ |
| 442 | } |
| 443 | if( g.argc!=4 && g.argc!=5 ){ |
| 444 | usage("?OPTIONS? PREFIX TEXT ?ORIGTEXT?"); |
| 445 | } |
| 446 | zPrefix = g.argv[2]; |
| @@ -467,14 +482,16 @@ | |
| 467 | if( zOrigText ){ |
| 468 | zOrigText = mprintf(fromFile ? "%z" : "%s", zOrigText); |
| 469 | defossilize(zOrigText); |
| 470 | } |
| 471 | } |
| 472 | indent = strlen(zPrefix); |
| 473 | if( indent>0 ){ |
| 474 | fossil_print("%s", zPrefix); |
| 475 | } |
| 476 | fossil_print("(%d lines output)\n", |
| 477 | comment_print(zText, zOrigText, indent, width, flags)); |
| 478 | if( zOrigText && zOrigText!=g.argv[4] ) fossil_free(zOrigText); |
| 479 | if( zText && zText!=g.argv[3] ) fossil_free(zText); |
| 480 | } |
| 481 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -121,11 +121,14 @@ | |
| 121 | ** a new line -OR- runs out of space on the logical line. |
| 122 | */ |
| 123 | static void comment_print_line( |
| 124 | const char *zOrigText, /* [in] Original comment text ONLY, may be NULL. */ |
| 125 | const char *zLine, /* [in] The comment line to print. */ |
| 126 | int origIndent, /* [in] Number of spaces to indent before the original |
| 127 | ** comment. */ |
| 128 | int indent, /* [in] Number of spaces to indent, before the line |
| 129 | ** to print. */ |
| 130 | int lineChars, /* [in] Maximum number of characters to print. */ |
| 131 | int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */ |
| 132 | int wordBreak, /* [in] Non-zero to try breaking on word boundaries. */ |
| 133 | int origBreak, /* [in] Non-zero to break before original comment. */ |
| 134 | int *pLineCnt, /* [in/out] Pointer to the total line count. */ |
| @@ -140,11 +143,13 @@ | |
| 143 | char c = zLine[index]; |
| 144 | if( c==0 ){ |
| 145 | break; |
| 146 | }else{ |
| 147 | if( origBreak && index>0 ){ |
| 148 | const char *zCurrent = &zLine[index]; |
| 149 | if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){ |
| 150 | comment_print_indent(zCurrent, origIndent, trimSpace, &index); |
| 151 | maxChars = lineChars; |
| 152 | } |
| 153 | } |
| 154 | index++; |
| 155 | } |
| @@ -383,12 +388,13 @@ | |
| 388 | lineCnt++; |
| 389 | return lineCnt; |
| 390 | } |
| 391 | zLine = zText; |
| 392 | for(;;){ |
| 393 | comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0, |
| 394 | maxChars, trimSpace, wordBreak, origBreak, &lineCnt, |
| 395 | &zLine); |
| 396 | if( !zLine || !zLine[0] ) break; |
| 397 | } |
| 398 | return lineCnt; |
| 399 | } |
| 400 | |
| @@ -408,15 +414,18 @@ | |
| 414 | ** --legacy Use the legacy comment printing algorithm. |
| 415 | ** --trimspace Enable trimming of leading/trailing spaces. |
| 416 | ** --wordbreak Attempt to break lines on word boundaries. |
| 417 | ** --origbreak Attempt to break when the original comment text |
| 418 | ** is detected. |
| 419 | ** --indent Number of spaces to indent (default (-1) is to |
| 420 | ** auto-detect). Zero means no indent. |
| 421 | ** -W|--width <num> Width of lines (default (-1) is to auto-detect). |
| 422 | ** Zero means no limit. |
| 423 | */ |
| 424 | void test_comment_format(void){ |
| 425 | const char *zWidth; |
| 426 | const char *zIndent; |
| 427 | const char *zPrefix; |
| 428 | char *zText; |
| 429 | char *zOrigText; |
| 430 | int indent, width; |
| 431 | int fromFile = find_option("file", 0, 0)!=0; |
| @@ -437,10 +446,16 @@ | |
| 446 | zWidth = find_option("width","W",1); |
| 447 | if( zWidth ){ |
| 448 | width = atoi(zWidth); |
| 449 | }else{ |
| 450 | width = -1; /* automatic */ |
| 451 | } |
| 452 | zIndent = find_option("indent",0,1); |
| 453 | if( zIndent ){ |
| 454 | indent = atoi(zIndent); |
| 455 | }else{ |
| 456 | indent = -1; /* automatic */ |
| 457 | } |
| 458 | if( g.argc!=4 && g.argc!=5 ){ |
| 459 | usage("?OPTIONS? PREFIX TEXT ?ORIGTEXT?"); |
| 460 | } |
| 461 | zPrefix = g.argv[2]; |
| @@ -467,14 +482,16 @@ | |
| 482 | if( zOrigText ){ |
| 483 | zOrigText = mprintf(fromFile ? "%z" : "%s", zOrigText); |
| 484 | defossilize(zOrigText); |
| 485 | } |
| 486 | } |
| 487 | if( indent<0 ){ |
| 488 | indent = strlen(zPrefix); |
| 489 | } |
| 490 | if( zPrefix && *zPrefix ){ |
| 491 | fossil_print("%s", zPrefix); |
| 492 | } |
| 493 | fossil_print("(%d lines output)\n", |
| 494 | comment_print(zText, zOrigText, indent, width, flags)); |
| 495 | if( zOrigText && zOrigText!=g.argv[4] ) fossil_free(zOrigText); |
| 496 | if( zText && zText!=g.argv[3] ) fossil_free(zText); |
| 497 | } |
| 498 |
+22
-2
| --- test/comment.test | ||
| +++ test/comment.test | ||
| @@ -227,12 +227,32 @@ | ||
| 227 | 227 | test comment-42 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} |
| 228 | 228 | |
| 229 | 229 | ############################################################################### |
| 230 | 230 | |
| 231 | 231 | set orig "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\\nxxxxxxx." |
| 232 | -fossil test-comment-format --width 73 --decode --origbreak "" $orig $orig | |
| 232 | +fossil test-comment-format --width 73 --decode --origbreak "" $orig | |
| 233 | 233 | test comment-43 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"} |
| 234 | 234 | |
| 235 | 235 | ############################################################################### |
| 236 | 236 | |
| 237 | +fossil test-comment-format --width 73 --decode --origbreak "" $orig $orig | |
| 238 | +test comment-44 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"} | |
| 239 | + | |
| 240 | +############################################################################### | |
| 241 | + | |
| 237 | 242 | fossil test-comment-format --width 73 --decode --origbreak "" "00:00:00 \[0000000000\] *CURRENT* $orig" $orig |
| 238 | -test comment-44 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \nxxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(6 lines output)"} | |
| 243 | +test comment-45 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \nxxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(6 lines output)"} | |
| 244 | + | |
| 245 | +############################################################################### | |
| 246 | + | |
| 247 | +fossil test-comment-format --width 82 --indent 9 --decode --origbreak " " $orig | |
| 248 | +test comment-46 {$RESULT eq " xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(5 lines output)"} | |
| 249 | + | |
| 250 | +############################################################################### | |
| 251 | + | |
| 252 | +fossil test-comment-format --width 82 --indent 9 --decode --origbreak " " $orig $orig | |
| 253 | +test comment-47 {$RESULT eq " xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(5 lines output)"} | |
| 254 | + | |
| 255 | +############################################################################### | |
| 256 | + | |
| 257 | +fossil test-comment-format --width 82 --indent 9 --decode --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig | |
| 258 | +test comment-48 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"} | |
| 239 | 259 |
| --- test/comment.test | |
| +++ test/comment.test | |
| @@ -227,12 +227,32 @@ | |
| 227 | test comment-42 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} |
| 228 | |
| 229 | ############################################################################### |
| 230 | |
| 231 | set orig "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\\nxxxxxxx." |
| 232 | fossil test-comment-format --width 73 --decode --origbreak "" $orig $orig |
| 233 | test comment-43 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"} |
| 234 | |
| 235 | ############################################################################### |
| 236 | |
| 237 | fossil test-comment-format --width 73 --decode --origbreak "" "00:00:00 \[0000000000\] *CURRENT* $orig" $orig |
| 238 | test comment-44 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \nxxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(6 lines output)"} |
| 239 |
| --- test/comment.test | |
| +++ test/comment.test | |
| @@ -227,12 +227,32 @@ | |
| 227 | test comment-42 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} |
| 228 | |
| 229 | ############################################################################### |
| 230 | |
| 231 | set orig "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\\nxxxxxxx." |
| 232 | fossil test-comment-format --width 73 --decode --origbreak "" $orig |
| 233 | test comment-43 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"} |
| 234 | |
| 235 | ############################################################################### |
| 236 | |
| 237 | fossil test-comment-format --width 73 --decode --origbreak "" $orig $orig |
| 238 | test comment-44 {$RESULT eq "xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(5 lines output)"} |
| 239 | |
| 240 | ############################################################################### |
| 241 | |
| 242 | fossil test-comment-format --width 73 --decode --origbreak "" "00:00:00 \[0000000000\] *CURRENT* $orig" $orig |
| 243 | test comment-45 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \nxxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\nxxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\nxxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\nxxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\nxxxxxxx.\n(6 lines output)"} |
| 244 | |
| 245 | ############################################################################### |
| 246 | |
| 247 | fossil test-comment-format --width 82 --indent 9 --decode --origbreak " " $orig |
| 248 | test comment-46 {$RESULT eq " xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(5 lines output)"} |
| 249 | |
| 250 | ############################################################################### |
| 251 | |
| 252 | fossil test-comment-format --width 82 --indent 9 --decode --origbreak " " $orig $orig |
| 253 | test comment-47 {$RESULT eq " xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(5 lines output)"} |
| 254 | |
| 255 | ############################################################################### |
| 256 | |
| 257 | fossil test-comment-format --width 82 --indent 9 --decode --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig |
| 258 | test comment-48 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"} |
| 259 |