1#
2# Copyright (c) 2015 D. Richard Hipp
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the Simplified BSD License (also
6# known as the "2-Clause License" or "FreeBSD License".)
7#
8# This program is distributed in the hope that it will be useful,
9# but without any warranty; without even the implied warranty of
10# merchantability or fitness for a particular purpose.
11#
12# Author contact information:
13#   drh@hwaci.com
14#   http://www.hwaci.com/drh/
15#
16############################################################################
17#
18# TH1 Docs
19#
20
21fossil test-th-eval "hasfeature th1Docs"
22
23if {[normalize_result] ne "1"} {
24  puts "Fossil was not compiled with TH1 docs support."
25  test_cleanup_then_return
26}
27
28fossil test-th-eval "hasfeature tcl"
29
30if {[normalize_result] ne "1"} {
31  puts "Fossil was not compiled with Tcl support."
32  test_cleanup_then_return
33}
34
35if {$::outside_fossil_repo} {
36  puts "Skipping th1-docs-* tests: not in Fossil repo checkout."
37  test_cleanup_then_return
38} elseif ($::dirty_ckout) {
39  puts "Skipping th1-docs-* tests: uncommitted changes in Fossil checkout."
40  test_cleanup_then_return
41}
42
43###############################################################################
44
45test_setup ""
46
47###############################################################################
48
49set env(TH1_ENABLE_DOCS) 1; # TH1 docs must be enabled for this test.
50set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
51
52###############################################################################
53
54run_in_checkout {
55  set data [fossil info]
56}
57
58regexp -line -- {^repository:   (.*)$} $data dummy repository
59
60if {[string length $repository] == 0 || ![file exists $repository]} {
61  error "unable to locate repository"
62}
63
64set dataFileName [file join $::testdir th1-docs-input.txt]
65
66###############################################################################
67
68run_in_checkout {
69  set RESULT [test_fossil_http \
70      $repository $dataFileName /doc/trunk/test/fileStat.th1]
71}
72
73test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]}
74test th1-docs-1b {[regexp {>\[[0-9a-f]{40,64}\]<} $RESULT]}
75test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
76
77###############################################################################
78
79test_cleanup
80