Fossil

Check-in [5d700c7d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Defer requiring json loading until after it is determined that fossil json works.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5d700c7d852ff11f688b92ab7eb434069a8cbdf7
User & Date: andybradford 2016-02-07 04:15:45
Context
2016-02-07
22:55
Use the 'hasfeature' TH1 command to test if JSON was included at compile-time. check-in: 09a46c28 user: mistachkin tags: trunk
04:15
Defer requiring json loading until after it is determined that fossil json works. check-in: 5d700c7d user: andybradford tags: trunk
2016-02-06
22:41
Fixed json.test problem with fossil configured without --json. Removed the knownBug marker from the test json-wiki-diff-diff since [08197f96] fixed the bug it identified. check-in: c35152a5 user: rberteig tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/json.test.

13
14
15
16
17
18
19










20
21
22
23
24
25
26
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
############################################################################
#
# Test JSON Support
#











# We need a JSON parser to effectively test the JSON produced by
# fossil. It looks like the one from tcllib is exactly what we need.
# On ActiveTcl, add it with teacup. On other platforms, YMMV.
# teacup install json
# teacup install json::write
package require json
................................................................................
  if {$rc != 0} {
    protOut "JSON ERROR: $result" 
    return {}
  }
  return $result
}

# Make sure we have a build with the json command at all and that it
# is not stubbed out. This assumes the current (as of 2016-01-27)
# practice of eliminating all trace of the fossil json command when
# not configured. If that changes, these conditions might not prevent
# the rest of this file from running.
fossil help -a
if {[string first json $RESULT] < 0} {
  puts "Fossil was not compiled with JSON support (fossil help -a)."; return
}

# and that the json itself smells ok and has the expected API error code in it
fossil json -expectError 
set JR [json2dict $RESULT]
if {$JR eq ""} {
  puts "Fossil was not compiled with JSON support (bad JSON)."; return
}
test json-1 {[dict exists $JR resultCode]







>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
..
40
41
42
43
44
45
46










47
48
49
50
51
52
53
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
############################################################################
#
# Test JSON Support
#

# Make sure we have a build with the json command at all and that it
# is not stubbed out. This assumes the current (as of 2016-01-27)
# practice of eliminating all trace of the fossil json command when
# not configured. If that changes, these conditions might not prevent
# the rest of this file from running.
fossil help -a
if {[string first json $RESULT] < 0} {
  puts "Fossil was not compiled with JSON support (fossil help -a)."; return
}

# We need a JSON parser to effectively test the JSON produced by
# fossil. It looks like the one from tcllib is exactly what we need.
# On ActiveTcl, add it with teacup. On other platforms, YMMV.
# teacup install json
# teacup install json::write
package require json
................................................................................
  if {$rc != 0} {
    protOut "JSON ERROR: $result" 
    return {}
  }
  return $result
}











# and that the json itself smells ok and has the expected API error code in it
fossil json -expectError 
set JR [json2dict $RESULT]
if {$JR eq ""} {
  puts "Fossil was not compiled with JSON support (bad JSON)."; return
}
test json-1 {[dict exists $JR resultCode]