Fossil SCM
Defer requiring json loading until after it is determined that fossil json works.
Commit
5d700c7d852ff11f688b92ab7eb434069a8cbdf7
Parent
c35152a5d47257c…
1 file changed
+10
-10
+10
-10
| --- test/json.test | ||
| +++ test/json.test | ||
| @@ -15,10 +15,20 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Test JSON Support |
| 19 | 19 | # |
| 20 | + | |
| 21 | +# Make sure we have a build with the json command at all and that it | |
| 22 | +# is not stubbed out. This assumes the current (as of 2016-01-27) | |
| 23 | +# practice of eliminating all trace of the fossil json command when | |
| 24 | +# not configured. If that changes, these conditions might not prevent | |
| 25 | +# the rest of this file from running. | |
| 26 | +fossil help -a | |
| 27 | +if {[string first json $RESULT] < 0} { | |
| 28 | + puts "Fossil was not compiled with JSON support (fossil help -a)."; return | |
| 29 | +} | |
| 20 | 30 | |
| 21 | 31 | # We need a JSON parser to effectively test the JSON produced by |
| 22 | 32 | # fossil. It looks like the one from tcllib is exactly what we need. |
| 23 | 33 | # On ActiveTcl, add it with teacup. On other platforms, YMMV. |
| 24 | 34 | # teacup install json |
| @@ -32,20 +42,10 @@ | ||
| 32 | 42 | return {} |
| 33 | 43 | } |
| 34 | 44 | return $result |
| 35 | 45 | } |
| 36 | 46 | |
| 37 | -# Make sure we have a build with the json command at all and that it | |
| 38 | -# is not stubbed out. This assumes the current (as of 2016-01-27) | |
| 39 | -# practice of eliminating all trace of the fossil json command when | |
| 40 | -# not configured. If that changes, these conditions might not prevent | |
| 41 | -# the rest of this file from running. | |
| 42 | -fossil help -a | |
| 43 | -if {[string first json $RESULT] < 0} { | |
| 44 | - puts "Fossil was not compiled with JSON support (fossil help -a)."; return | |
| 45 | -} | |
| 46 | - | |
| 47 | 47 | # and that the json itself smells ok and has the expected API error code in it |
| 48 | 48 | fossil json -expectError |
| 49 | 49 | set JR [json2dict $RESULT] |
| 50 | 50 | if {$JR eq ""} { |
| 51 | 51 | puts "Fossil was not compiled with JSON support (bad JSON)."; return |
| 52 | 52 |
| --- test/json.test | |
| +++ test/json.test | |
| @@ -15,10 +15,20 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test JSON Support |
| 19 | # |
| 20 | |
| 21 | # We need a JSON parser to effectively test the JSON produced by |
| 22 | # fossil. It looks like the one from tcllib is exactly what we need. |
| 23 | # On ActiveTcl, add it with teacup. On other platforms, YMMV. |
| 24 | # teacup install json |
| @@ -32,20 +42,10 @@ | |
| 32 | return {} |
| 33 | } |
| 34 | return $result |
| 35 | } |
| 36 | |
| 37 | # Make sure we have a build with the json command at all and that it |
| 38 | # is not stubbed out. This assumes the current (as of 2016-01-27) |
| 39 | # practice of eliminating all trace of the fossil json command when |
| 40 | # not configured. If that changes, these conditions might not prevent |
| 41 | # the rest of this file from running. |
| 42 | fossil help -a |
| 43 | if {[string first json $RESULT] < 0} { |
| 44 | puts "Fossil was not compiled with JSON support (fossil help -a)."; return |
| 45 | } |
| 46 | |
| 47 | # and that the json itself smells ok and has the expected API error code in it |
| 48 | fossil json -expectError |
| 49 | set JR [json2dict $RESULT] |
| 50 | if {$JR eq ""} { |
| 51 | puts "Fossil was not compiled with JSON support (bad JSON)."; return |
| 52 |
| --- test/json.test | |
| +++ test/json.test | |
| @@ -15,10 +15,20 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test JSON Support |
| 19 | # |
| 20 | |
| 21 | # Make sure we have a build with the json command at all and that it |
| 22 | # is not stubbed out. This assumes the current (as of 2016-01-27) |
| 23 | # practice of eliminating all trace of the fossil json command when |
| 24 | # not configured. If that changes, these conditions might not prevent |
| 25 | # the rest of this file from running. |
| 26 | fossil help -a |
| 27 | if {[string first json $RESULT] < 0} { |
| 28 | puts "Fossil was not compiled with JSON support (fossil help -a)."; return |
| 29 | } |
| 30 | |
| 31 | # We need a JSON parser to effectively test the JSON produced by |
| 32 | # fossil. It looks like the one from tcllib is exactly what we need. |
| 33 | # On ActiveTcl, add it with teacup. On other platforms, YMMV. |
| 34 | # teacup install json |
| @@ -32,20 +42,10 @@ | |
| 42 | return {} |
| 43 | } |
| 44 | return $result |
| 45 | } |
| 46 | |
| 47 | # and that the json itself smells ok and has the expected API error code in it |
| 48 | fossil json -expectError |
| 49 | set JR [json2dict $RESULT] |
| 50 | if {$JR eq ""} { |
| 51 | puts "Fossil was not compiled with JSON support (bad JSON)."; return |
| 52 |