Fossil SCM
Added test case for /json/diff/UUID_V1/UUID_V2. Note that this case passes and clearly does diff the versions in the expected order.
Commit
f28e771369fe2e3eb97b9f92d83a201005ec0b83
Parent
dc042c6a621ef0a…
1 file changed
+32
-4
+32
-4
| --- test/json.test | ||
| +++ test/json.test | ||
| @@ -69,10 +69,11 @@ | ||
| 69 | 69 | if {$status eq "200"} { |
| 70 | 70 | set JR [::json::json2dict $body] |
| 71 | 71 | } |
| 72 | 72 | return $status |
| 73 | 73 | } |
| 74 | + | |
| 74 | 75 | |
| 75 | 76 | # Inspect a dict for keys it must have and keys it must not have |
| 76 | 77 | proc test_dict_keys {testname D okfields badfields} { |
| 77 | 78 | set i 1 |
| 78 | 79 | foreach f $okfields { |
| @@ -277,11 +278,38 @@ | ||
| 277 | 278 | # payload depends on specific area and may be completely empty |
| 278 | 279 | } |
| 279 | 280 | |
| 280 | 281 | #### DIFFS |
| 281 | 282 | # json diff v1 v2 |
| 282 | -test TODO-json-diff false knownBug | |
| 283 | + | |
| 284 | +write_file fish { | |
| 285 | +ABCD goldfish | |
| 286 | +} | |
| 287 | +fossil add fish | |
| 288 | +fossil ci -m "goldfish" | |
| 289 | +fossil_json finfo fish | |
| 290 | +set fishHist [dict get $JR payload checkins] | |
| 291 | +set fishV1 [dict get [lindex $fishHist 0] uuid] | |
| 292 | + | |
| 293 | +write_file fish { | |
| 294 | +ABCD goldfish | |
| 295 | +LMNO goldfish | |
| 296 | +} | |
| 297 | +fossil ci -m "goldfish" | |
| 298 | +fossil_json finfo fish | |
| 299 | +set fishHist [dict get $JR payload checkins] | |
| 300 | +set fishV2 [dict get [lindex $fishHist 0] uuid] | |
| 301 | + | |
| 302 | +test fossil-diff-setup {$fishV1 ne $fishV2} | |
| 303 | +fossil_json diff $fishV1 $fishV2 | |
| 304 | +test_json_envelope_ok json-diff-env | |
| 305 | +test_json_payload json-diff {from to diff} {} | |
| 306 | +test json-diff-v1 {[dict get $JR payload from] eq $fishV1} | |
| 307 | +test json-diff-v2 {[dict get $JR payload to] eq $fishV2} | |
| 308 | +set diff [dict get $JR payload diff] | |
| 309 | +test json-diff-diff {[string first "+LMNO goldfish" $diff] >= 0} | |
| 310 | +protOut [dict get $JR payload diff] | |
| 283 | 311 | |
| 284 | 312 | |
| 285 | 313 | #### DIRECTORY LISTING |
| 286 | 314 | # json dir DIRNAME |
| 287 | 315 | fossil_json dir |
| @@ -535,11 +563,13 @@ | ||
| 535 | 563 | # foreach c $codes { |
| 536 | 564 | # puts [dict values $c] |
| 537 | 565 | # } |
| 538 | 566 | |
| 539 | 567 | |
| 540 | -##### From the API Docs | |
| 568 | + | |
| 569 | +#### From the API Docs | |
| 570 | + | |
| 541 | 571 | # Reminder to self: in March 2012 i saw a corner-case which returns |
| 542 | 572 | # HTML output. To reproduce: chmod 444 REPO, then submit a request |
| 543 | 573 | # which writes something (timeline creates a temp table). The "repo |
| 544 | 574 | # is not writable" error comes back as HTML. i don't know if the |
| 545 | 575 | # error happens before we have made the determination that the app is |
| @@ -558,10 +588,8 @@ | ||
| 558 | 588 | fossil_http_json /json/timeline/checkin $U1Cookie -expectError |
| 559 | 589 | test json-ROrepo-2-1 {$CODE != 0} |
| 560 | 590 | test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]} knownBug |
| 561 | 591 | test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} knownBug |
| 562 | 592 | #test_json_envelope_ok json-http-timeline2 |
| 563 | - | |
| 564 | - | |
| 565 | 593 | catch {exec chmod 666 .rep.fossil}; # Unix. What about Win? |
| 566 | 594 | |
| 567 | 595 | |
| 568 | 596 |
| --- test/json.test | |
| +++ test/json.test | |
| @@ -69,10 +69,11 @@ | |
| 69 | if {$status eq "200"} { |
| 70 | set JR [::json::json2dict $body] |
| 71 | } |
| 72 | return $status |
| 73 | } |
| 74 | |
| 75 | # Inspect a dict for keys it must have and keys it must not have |
| 76 | proc test_dict_keys {testname D okfields badfields} { |
| 77 | set i 1 |
| 78 | foreach f $okfields { |
| @@ -277,11 +278,38 @@ | |
| 277 | # payload depends on specific area and may be completely empty |
| 278 | } |
| 279 | |
| 280 | #### DIFFS |
| 281 | # json diff v1 v2 |
| 282 | test TODO-json-diff false knownBug |
| 283 | |
| 284 | |
| 285 | #### DIRECTORY LISTING |
| 286 | # json dir DIRNAME |
| 287 | fossil_json dir |
| @@ -535,11 +563,13 @@ | |
| 535 | # foreach c $codes { |
| 536 | # puts [dict values $c] |
| 537 | # } |
| 538 | |
| 539 | |
| 540 | ##### From the API Docs |
| 541 | # Reminder to self: in March 2012 i saw a corner-case which returns |
| 542 | # HTML output. To reproduce: chmod 444 REPO, then submit a request |
| 543 | # which writes something (timeline creates a temp table). The "repo |
| 544 | # is not writable" error comes back as HTML. i don't know if the |
| 545 | # error happens before we have made the determination that the app is |
| @@ -558,10 +588,8 @@ | |
| 558 | fossil_http_json /json/timeline/checkin $U1Cookie -expectError |
| 559 | test json-ROrepo-2-1 {$CODE != 0} |
| 560 | test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]} knownBug |
| 561 | test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} knownBug |
| 562 | #test_json_envelope_ok json-http-timeline2 |
| 563 | |
| 564 | |
| 565 | catch {exec chmod 666 .rep.fossil}; # Unix. What about Win? |
| 566 | |
| 567 | |
| 568 |
| --- test/json.test | |
| +++ test/json.test | |
| @@ -69,10 +69,11 @@ | |
| 69 | if {$status eq "200"} { |
| 70 | set JR [::json::json2dict $body] |
| 71 | } |
| 72 | return $status |
| 73 | } |
| 74 | |
| 75 | |
| 76 | # Inspect a dict for keys it must have and keys it must not have |
| 77 | proc test_dict_keys {testname D okfields badfields} { |
| 78 | set i 1 |
| 79 | foreach f $okfields { |
| @@ -277,11 +278,38 @@ | |
| 278 | # payload depends on specific area and may be completely empty |
| 279 | } |
| 280 | |
| 281 | #### DIFFS |
| 282 | # json diff v1 v2 |
| 283 | |
| 284 | write_file fish { |
| 285 | ABCD goldfish |
| 286 | } |
| 287 | fossil add fish |
| 288 | fossil ci -m "goldfish" |
| 289 | fossil_json finfo fish |
| 290 | set fishHist [dict get $JR payload checkins] |
| 291 | set fishV1 [dict get [lindex $fishHist 0] uuid] |
| 292 | |
| 293 | write_file fish { |
| 294 | ABCD goldfish |
| 295 | LMNO goldfish |
| 296 | } |
| 297 | fossil ci -m "goldfish" |
| 298 | fossil_json finfo fish |
| 299 | set fishHist [dict get $JR payload checkins] |
| 300 | set fishV2 [dict get [lindex $fishHist 0] uuid] |
| 301 | |
| 302 | test fossil-diff-setup {$fishV1 ne $fishV2} |
| 303 | fossil_json diff $fishV1 $fishV2 |
| 304 | test_json_envelope_ok json-diff-env |
| 305 | test_json_payload json-diff {from to diff} {} |
| 306 | test json-diff-v1 {[dict get $JR payload from] eq $fishV1} |
| 307 | test json-diff-v2 {[dict get $JR payload to] eq $fishV2} |
| 308 | set diff [dict get $JR payload diff] |
| 309 | test json-diff-diff {[string first "+LMNO goldfish" $diff] >= 0} |
| 310 | protOut [dict get $JR payload diff] |
| 311 | |
| 312 | |
| 313 | #### DIRECTORY LISTING |
| 314 | # json dir DIRNAME |
| 315 | fossil_json dir |
| @@ -535,11 +563,13 @@ | |
| 563 | # foreach c $codes { |
| 564 | # puts [dict values $c] |
| 565 | # } |
| 566 | |
| 567 | |
| 568 | |
| 569 | #### From the API Docs |
| 570 | |
| 571 | # Reminder to self: in March 2012 i saw a corner-case which returns |
| 572 | # HTML output. To reproduce: chmod 444 REPO, then submit a request |
| 573 | # which writes something (timeline creates a temp table). The "repo |
| 574 | # is not writable" error comes back as HTML. i don't know if the |
| 575 | # error happens before we have made the determination that the app is |
| @@ -558,10 +588,8 @@ | |
| 588 | fossil_http_json /json/timeline/checkin $U1Cookie -expectError |
| 589 | test json-ROrepo-2-1 {$CODE != 0} |
| 590 | test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]} knownBug |
| 591 | test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} knownBug |
| 592 | #test_json_envelope_ok json-http-timeline2 |
| 593 | catch {exec chmod 666 .rep.fossil}; # Unix. What about Win? |
| 594 | |
| 595 | |
| 596 |