Fossil SCM
Add and adjust comment tests from the experimental branch.
Commit
2920e7df00b9d96acb50f8b3249eb75a85fad4ba
Parent
e02795056d3d01b…
2 files changed
+2
+71
-6
+2
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -139,16 +139,18 @@ | ||
| 139 | 139 | ** Test comment formatting and printing. Use for testing only. |
| 140 | 140 | ** |
| 141 | 141 | ** Options: |
| 142 | 142 | ** --decode Decode the text using the same method used when |
| 143 | 143 | ** handling the value of a C-card from a manifest. |
| 144 | +** --wordbreak This does nothing and is ignored. | |
| 144 | 145 | */ |
| 145 | 146 | void test_comment_format(void){ |
| 146 | 147 | const char *zPrefix; |
| 147 | 148 | char *zText; |
| 148 | 149 | int indent, width; |
| 149 | 150 | int decode = find_option("decode", 0, 0)!=0; |
| 151 | + find_option("wordbreak", 0, 0); /* NOT USED */ | |
| 150 | 152 | if( g.argc!=4 && g.argc!=5 ){ |
| 151 | 153 | usage("PREFIX TEXT ?WIDTH?"); |
| 152 | 154 | } |
| 153 | 155 | zPrefix = g.argv[2]; |
| 154 | 156 | if( decode ){ |
| 155 | 157 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -139,16 +139,18 @@ | |
| 139 | ** Test comment formatting and printing. Use for testing only. |
| 140 | ** |
| 141 | ** Options: |
| 142 | ** --decode Decode the text using the same method used when |
| 143 | ** handling the value of a C-card from a manifest. |
| 144 | */ |
| 145 | void test_comment_format(void){ |
| 146 | const char *zPrefix; |
| 147 | char *zText; |
| 148 | int indent, width; |
| 149 | int decode = find_option("decode", 0, 0)!=0; |
| 150 | if( g.argc!=4 && g.argc!=5 ){ |
| 151 | usage("PREFIX TEXT ?WIDTH?"); |
| 152 | } |
| 153 | zPrefix = g.argv[2]; |
| 154 | if( decode ){ |
| 155 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -139,16 +139,18 @@ | |
| 139 | ** Test comment formatting and printing. Use for testing only. |
| 140 | ** |
| 141 | ** Options: |
| 142 | ** --decode Decode the text using the same method used when |
| 143 | ** handling the value of a C-card from a manifest. |
| 144 | ** --wordbreak This does nothing and is ignored. |
| 145 | */ |
| 146 | void test_comment_format(void){ |
| 147 | const char *zPrefix; |
| 148 | char *zText; |
| 149 | int indent, width; |
| 150 | int decode = find_option("decode", 0, 0)!=0; |
| 151 | find_option("wordbreak", 0, 0); /* NOT USED */ |
| 152 | if( g.argc!=4 && g.argc!=5 ){ |
| 153 | usage("PREFIX TEXT ?WIDTH?"); |
| 154 | } |
| 155 | zPrefix = g.argv[2]; |
| 156 | if( decode ){ |
| 157 |
+71
-6
| --- test/comment.test | ||
| +++ test/comment.test | ||
| @@ -26,16 +26,16 @@ | ||
| 26 | 26 | fossil test-comment-format --decode "" "" |
| 27 | 27 | test comment-2 {$RESULT eq "\n(1 lines output)"} |
| 28 | 28 | |
| 29 | 29 | ############################################################################### |
| 30 | 30 | |
| 31 | -fossil test-comment-format " " "this is a short comment." 25 | |
| 31 | +fossil test-comment-format " " "this is a short comment." 26 | |
| 32 | 32 | test comment-3 {$RESULT eq " this is a short comment.\n(1 lines output)"} |
| 33 | 33 | |
| 34 | 34 | ############################################################################### |
| 35 | 35 | |
| 36 | -fossil test-comment-format --decode " " "this is a short comment." 25 | |
| 36 | +fossil test-comment-format --decode " " "this is a short comment." 26 | |
| 37 | 37 | test comment-4 {$RESULT eq " this is a short comment.\n(1 lines output)"} |
| 38 | 38 | |
| 39 | 39 | ############################################################################### |
| 40 | 40 | |
| 41 | 41 | fossil test-comment-format "*PREFIX* " "this is a short comment." 25 |
| @@ -46,12 +46,77 @@ | ||
| 46 | 46 | fossil test-comment-format --decode "*PREFIX* " "this is a short comment." 25 |
| 47 | 47 | test comment-6 {$RESULT eq "*PREFIX* this is a short\n comment.\n(2 lines output)"} |
| 48 | 48 | |
| 49 | 49 | ############################################################################### |
| 50 | 50 | |
| 51 | -fossil test-comment-format "" "this\\sis\\sa\\sshort\\scomment." | |
| 52 | -test comment-7 {$RESULT eq "this\\sis\\sa\\sshort\\scomment.\n(1 lines output)"} | |
| 51 | +fossil test-comment-format "" "this\\sis\\sa\\sshort\\scomment." 26 | |
| 52 | +test comment-7 {$RESULT eq "this\\sis\\sa\\sshort\\scommen\nt.\n(2 lines output)"} | |
| 53 | + | |
| 54 | +############################################################################### | |
| 55 | + | |
| 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\n is 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\n is working correctly. more text here describing the issue. another\n line\n here.................................................................\n .................*\n(5 lines output)"} | |
| 68 | + | |
| 69 | +############################################################################### | |
| 70 | + | |
| 71 | +fossil test-comment-format "HH:MM:SS " "....................................................................................*" 78 | |
| 72 | +test comment-11 {$RESULT eq "HH:MM:SS .....................................................................\n ...............*\n(2 lines output)"} | |
| 73 | + | |
| 74 | +############################################################################### | |
| 75 | + | |
| 76 | +fossil test-comment-format "HH:MM:SS " ".....................................................................*" 78 | |
| 77 | +test comment-12 {$RESULT eq "HH:MM:SS .....................................................................\n *\n(2 lines output)"} | |
| 78 | + | |
| 79 | +############################################################################### | |
| 80 | + | |
| 81 | +fossil test-comment-format "*TEST* " "this\tis a test." 26 | |
| 82 | +test comment-13 {$RESULT eq "*TEST* this is a test.\n(1 lines output)"} | |
| 83 | + | |
| 84 | +############################################################################### | |
| 85 | + | |
| 86 | +fossil test-comment-format "*TEST* " "this is a test......................................................................................................................." 60 | |
| 87 | +test comment-14 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} | |
| 88 | + | |
| 89 | +############################################################################### | |
| 90 | + | |
| 91 | +fossil test-comment-format --wordbreak "*TEST* " "this is a test......................................................................................................................." 60 | |
| 92 | +test comment-15 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} | |
| 93 | + | |
| 94 | +############################################################################### | |
| 95 | + | |
| 96 | +fossil test-comment-format "*TEST* " "this is a test......................................................................................................................." 60 | |
| 97 | +test comment-16 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} | |
| 98 | + | |
| 99 | +############################################################################### | |
| 100 | + | |
| 101 | +fossil test-comment-format --wordbreak "*TEST* " "this is a test......................................................................................................................." 60 | |
| 102 | +test comment-17 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} | |
| 103 | + | |
| 104 | +############################################################################### | |
| 105 | + | |
| 106 | +fossil test-comment-format "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 | |
| 107 | +test comment-18 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} | |
| 108 | + | |
| 109 | +############################################################################### | |
| 110 | + | |
| 111 | +fossil test-comment-format --wordbreak "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 | |
| 112 | +test comment-19 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} | |
| 113 | + | |
| 114 | +############################################################################### | |
| 115 | + | |
| 116 | +fossil test-comment-format "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 | |
| 117 | +test comment-20 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} | |
| 53 | 118 | |
| 54 | 119 | ############################################################################### |
| 55 | 120 | |
| 56 | -fossil test-comment-format --decode "" "this\\sis\\sa\\sshort\\scomment." | |
| 57 | -test comment-8 {$RESULT eq "this is a short comment.\n(1 lines output)"} | |
| 121 | +fossil test-comment-format --wordbreak "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 | |
| 122 | +test comment-21 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} | |
| 58 | 123 |
| --- test/comment.test | |
| +++ test/comment.test | |
| @@ -26,16 +26,16 @@ | |
| 26 | fossil test-comment-format --decode "" "" |
| 27 | test comment-2 {$RESULT eq "\n(1 lines output)"} |
| 28 | |
| 29 | ############################################################################### |
| 30 | |
| 31 | fossil test-comment-format " " "this is a short comment." 25 |
| 32 | test comment-3 {$RESULT eq " this is a short comment.\n(1 lines output)"} |
| 33 | |
| 34 | ############################################################################### |
| 35 | |
| 36 | fossil test-comment-format --decode " " "this is a short comment." 25 |
| 37 | test comment-4 {$RESULT eq " this is a short comment.\n(1 lines output)"} |
| 38 | |
| 39 | ############################################################################### |
| 40 | |
| 41 | fossil test-comment-format "*PREFIX* " "this is a short comment." 25 |
| @@ -46,12 +46,77 @@ | |
| 46 | fossil test-comment-format --decode "*PREFIX* " "this is a short comment." 25 |
| 47 | test comment-6 {$RESULT eq "*PREFIX* this is a short\n comment.\n(2 lines output)"} |
| 48 | |
| 49 | ############################################################################### |
| 50 | |
| 51 | fossil test-comment-format "" "this\\sis\\sa\\sshort\\scomment." |
| 52 | test comment-7 {$RESULT eq "this\\sis\\sa\\sshort\\scomment.\n(1 lines output)"} |
| 53 | |
| 54 | ############################################################################### |
| 55 | |
| 56 | fossil test-comment-format --decode "" "this\\sis\\sa\\sshort\\scomment." |
| 57 | test comment-8 {$RESULT eq "this is a short comment.\n(1 lines output)"} |
| 58 |
| --- test/comment.test | |
| +++ test/comment.test | |
| @@ -26,16 +26,16 @@ | |
| 26 | fossil test-comment-format --decode "" "" |
| 27 | test comment-2 {$RESULT eq "\n(1 lines output)"} |
| 28 | |
| 29 | ############################################################################### |
| 30 | |
| 31 | fossil test-comment-format " " "this is a short comment." 26 |
| 32 | test comment-3 {$RESULT eq " this is a short comment.\n(1 lines output)"} |
| 33 | |
| 34 | ############################################################################### |
| 35 | |
| 36 | fossil test-comment-format --decode " " "this is a short comment." 26 |
| 37 | test comment-4 {$RESULT eq " this is a short comment.\n(1 lines output)"} |
| 38 | |
| 39 | ############################################################################### |
| 40 | |
| 41 | fossil test-comment-format "*PREFIX* " "this is a short comment." 25 |
| @@ -46,12 +46,77 @@ | |
| 46 | fossil test-comment-format --decode "*PREFIX* " "this is a short comment." 25 |
| 47 | test comment-6 {$RESULT eq "*PREFIX* this is a short\n comment.\n(2 lines output)"} |
| 48 | |
| 49 | ############################################################################### |
| 50 | |
| 51 | fossil test-comment-format "" "this\\sis\\sa\\sshort\\scomment." 26 |
| 52 | test comment-7 {$RESULT eq "this\\sis\\sa\\sshort\\scommen\nt.\n(2 lines output)"} |
| 53 | |
| 54 | ############################################################################### |
| 55 | |
| 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\n is 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\n is working correctly. more text here describing the issue. another\n line\n here.................................................................\n .................*\n(5 lines output)"} |
| 68 | |
| 69 | ############################################################################### |
| 70 | |
| 71 | fossil test-comment-format "HH:MM:SS " "....................................................................................*" 78 |
| 72 | test comment-11 {$RESULT eq "HH:MM:SS .....................................................................\n ...............*\n(2 lines output)"} |
| 73 | |
| 74 | ############################################################################### |
| 75 | |
| 76 | fossil test-comment-format "HH:MM:SS " ".....................................................................*" 78 |
| 77 | test comment-12 {$RESULT eq "HH:MM:SS .....................................................................\n *\n(2 lines output)"} |
| 78 | |
| 79 | ############################################################################### |
| 80 | |
| 81 | fossil test-comment-format "*TEST* " "this\tis a test." 26 |
| 82 | test comment-13 {$RESULT eq "*TEST* this is a test.\n(1 lines output)"} |
| 83 | |
| 84 | ############################################################################### |
| 85 | |
| 86 | fossil test-comment-format "*TEST* " "this is a test......................................................................................................................." 60 |
| 87 | test comment-14 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} |
| 88 | |
| 89 | ############################################################################### |
| 90 | |
| 91 | fossil test-comment-format --wordbreak "*TEST* " "this is a test......................................................................................................................." 60 |
| 92 | test comment-15 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} |
| 93 | |
| 94 | ############################################################################### |
| 95 | |
| 96 | fossil test-comment-format "*TEST* " "this is a test......................................................................................................................." 60 |
| 97 | test comment-16 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} |
| 98 | |
| 99 | ############################################################################### |
| 100 | |
| 101 | fossil test-comment-format --wordbreak "*TEST* " "this is a test......................................................................................................................." 60 |
| 102 | test comment-17 {$RESULT eq "*TEST* this is a\n test.................................................\n .....................................................\n .................\n(4 lines output)"} |
| 103 | |
| 104 | ############################################################################### |
| 105 | |
| 106 | fossil test-comment-format "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 |
| 107 | test comment-18 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} |
| 108 | |
| 109 | ############################################################################### |
| 110 | |
| 111 | fossil test-comment-format --wordbreak "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 |
| 112 | test comment-19 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} |
| 113 | |
| 114 | ############################################################################### |
| 115 | |
| 116 | fossil test-comment-format "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 |
| 117 | test comment-20 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} |
| 118 | |
| 119 | ############################################################################### |
| 120 | |
| 121 | fossil test-comment-format --wordbreak "*TEST* " "one two three four five six seven eight nine ten eleven twelve" 60 |
| 122 | test comment-21 {$RESULT eq "*TEST* one two three four five six seven eight nine ten\n eleven twelve\n(2 lines output)"} |
| 123 |