Fossil

Check-in [25e9c00b]
Login

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

Overview
Comment:Restore read-only TH1 tests to their original file. Coding style fixes in tests. Add 'dir' command to the expected command list test.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | ckol-th1-dir-cmd
Files: files | file ages | folders
SHA1: 25e9c00b8c6baf9bb6dc63965f2028be1c4cdee8
User & Date: mistachkin 2015-08-15 18:47:17.858
Context
2015-08-15
18:48
Merge updates from trunk. ... (check-in: e4db8fe8 user: mistachkin tags: ckol-th1-dir-cmd)
18:47
Restore read-only TH1 tests to their original file. Coding style fixes in tests. Add 'dir' command to the expected command list test. ... (check-in: 25e9c00b user: mistachkin tags: ckol-th1-dir-cmd)
18:37
Coding style and compiler warning fixes. ... (check-in: 4b17cb66 user: mistachkin tags: ckol-th1-dir-cmd)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/th1-repo.test.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#   Chris Drexler <ckolumbus@ac-drexler.de>
#
############################################################################
#
# TH1-repo commands
#

catch {exec $::fossilexe info} res
puts res=$res
if {![regexp {use --repository} $res]} {
  puts stderr "Cannot run this test within an open checkout"
  return
}

########################################
# Setup: Add Files and Commit          #
########################################

set rootDir [file normalize [pwd]]

set undoMsg "\n \"fossil undo\" is\
available to undo changes to the\
working checkout."

repo_init

write_file f1.md  "f1"
write_file f2.md  "f2"
write_file f3.txt "f3"
write_file f4.md  "f4"

file mkdir [file join $rootDir test]
write_file [file join $rootDir test th1.test] "th1.test"

file mkdir [file join $rootDir subdirA]
# NOTE: There are no files in subdirA.

file mkdir [file join $rootDir subdirB]
write_file [file join $rootDir subdirB f5.md] "f5"
write_file [file join $rootDir subdirB f6.md] "f6"
write_file [file join $rootDir subdirB f7.txt] "f7"
write_file [file join $rootDir subdirB f8.md] "f8"
write_file [file join $rootDir subdirB f9.wiki] "f9"

file mkdir [file join $rootDir subdirC]
write_file [file join $rootDir subdirC f10.md] "f10"
write_file [file join $rootDir subdirC f11t.xt] "f11"


set files_md [list subdirB/f5.md subdirB/f6.md subdirB/f8.md subdirC/f10.md]

fossil add $rootDir
fossil commit -m "c1"

set dir [file dirname [info script]]


###############################################################################

fossil test-th-eval "checkout 1"; # NOTE: Assumes running "in tree".
test th1-checkout-1 {[string length $RESULT] > 0}

###############################################################################

fossil test-th-eval "checkout"; # NOTE: Assumes running "in tree".
test th1-checkout-2 {[string length $RESULT] > 0}

###############################################################################

set savedPwd [pwd]; cd /
fossil test-th-eval "checkout 1"
cd $savedPwd; unset savedPwd
test th1-checkout-3 {[string length $RESULT] == 0}

###############################################################################

set savedPwd [pwd]; cd /
fossil test-th-eval "checkout"
cd $savedPwd; unset savedPwd
test th1-checkout-4 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval "styleHeader {Page Title Here}"
test th1-header-1 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "styleHeader {Page Title Here}"
test th1-header-2 {[regexp -- {<title>Unnamed Fossil Project: Page Title Here</title>} $RESULT]}

###############################################################################

fossil test-th-eval "styleFooter"
test th1-footer-1 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "styleFooter"
test th1-footer-2 {$RESULT eq {}}

###############################################################################

fossil test-th-eval --open-config --cgi "styleHeader {}; styleFooter"
test th1-footer-3 {[regexp -- {</body></html>} $RESULT]}

###############################################################################

fossil test-th-eval "artifact"
test th1-artifact-1 {$RESULT eq \
    {TH_ERROR: wrong # args: should be "artifact ID ?FILENAME?"}}

###############################################################################

fossil test-th-eval "artifact tip"
test th1-artifact-2 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "artifact tip"
test th1-artifact-3 {[regexp -- {F test/th1\.test [0-9a-f]{40}} $RESULT]}

###############################################################################

fossil test-th-eval "artifact 0000000000"
test th1-artifact-4 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "artifact 0000000000"
test th1-artifact-5 {$RESULT eq {TH_ERROR: name not found}}

###############################################################################

fossil test-th-eval "artifact tip test/th1.test"
test th1-artifact-6 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "artifact tip test/th1.test"
test th1-artifact-7 {[regexp -- {th1\.test} $RESULT]}

###############################################################################

fossil test-th-eval "artifact 0000000000 test/th1.test"
test th1-artifact-8 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "artifact 0000000000 test/th1.test"
test th1-artifact-9 {$RESULT eq {TH_ERROR: manifest not found}}

###############################################################################

fossil test-th-eval "globalState checkout"
test th1-globalState-repo-1 {[string length $RESULT] > 0}

###############################################################################

fossil test-th-eval "globalState repository"
test th1-globalState-repo-2 {[string length $RESULT] > 0}


###############################################################################

fossil test-th-eval --open-config "dir trunk subdir*/*.md"
set l [llength $RESULT ]
test th1-dir-1  { $l eq [llength $files_md] }
set n 1
foreach i $RESULT j $files_md {
   test th1-dir-2-$n { $i eq $j }
   set n [expr $n + 1]
}








|



<











<
<
<
<







<
<
<














<







<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
|
<

<
<
<

<
<
<
<
<
<
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


|
|

<
14
15
16
17
18
19
20
21
22
23
24

25
26
27
28
29
30
31
32
33
34
35




36
37
38
39
40
41
42



43
44
45
46
47
48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63

64
65







































66

67

68



69









70



















































71
72
73
74
75

#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#   Chris Drexler <ckolumbus@ac-drexler.de>
#
############################################################################
#
# TH1 tests that may modify the repository
#

catch {exec $::fossilexe info} res

if {![regexp {use --repository} $res]} {
  puts stderr "Cannot run this test within an open checkout"
  return
}

########################################
# Setup: Add Files and Commit          #
########################################

set rootDir [file normalize [pwd]]





repo_init

write_file f1.md  "f1"
write_file f2.md  "f2"
write_file f3.txt "f3"
write_file f4.md  "f4"




file mkdir [file join $rootDir subdirA]
# NOTE: There are no files in subdirA.

file mkdir [file join $rootDir subdirB]
write_file [file join $rootDir subdirB f5.md] "f5"
write_file [file join $rootDir subdirB f6.md] "f6"
write_file [file join $rootDir subdirB f7.txt] "f7"
write_file [file join $rootDir subdirB f8.md] "f8"
write_file [file join $rootDir subdirB f9.wiki] "f9"

file mkdir [file join $rootDir subdirC]
write_file [file join $rootDir subdirC f10.md] "f10"
write_file [file join $rootDir subdirC f11t.xt] "f11"


set files_md [list subdirB/f5.md subdirB/f6.md subdirB/f8.md subdirC/f10.md]

fossil add $rootDir
fossil commit -m "c1"

set dir [file dirname [info script]]


###############################################################################








































fossil test-th-eval --open-config "dir trunk subdir*/*.md"

test th1-dir-1 {[llength $RESULT] eq [llength $files_md]}





###############################################################################





























































set n 1
foreach i $RESULT j $files_md {
   test th1-dir-2.$n {$i eq $j}
   set n [expr {$n + 1}]
}

Changes to test/th1.test.
550
551
552
553
554
555
556























557
558
559
560
561
562
563
test th1-expr-48 {$RESULT eq {TH_ERROR: expected integer, got: "+0x"}}

###############################################################################

fossil test-th-eval "lindex list -0x"
test th1-expr-49 {$RESULT eq {TH_ERROR: expected integer, got: "-0x"}}

























###############################################################################

fossil test-th-eval "render {}"
test th1-render-1 {$RESULT eq {}}

###############################################################################







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
test th1-expr-48 {$RESULT eq {TH_ERROR: expected integer, got: "+0x"}}

###############################################################################

fossil test-th-eval "lindex list -0x"
test th1-expr-49 {$RESULT eq {TH_ERROR: expected integer, got: "-0x"}}

###############################################################################

fossil test-th-eval "checkout 1"; # NOTE: Assumes running "in tree".
test th1-checkout-1 {[string length $RESULT] > 0}

###############################################################################

fossil test-th-eval "checkout"; # NOTE: Assumes running "in tree".
test th1-checkout-2 {[string length $RESULT] > 0}

###############################################################################

set savedPwd [pwd]; cd /
fossil test-th-eval "checkout 1"
cd $savedPwd; unset savedPwd
test th1-checkout-3 {[string length $RESULT] == 0}

###############################################################################

set savedPwd [pwd]; cd /
fossil test-th-eval "checkout"
cd $savedPwd; unset savedPwd
test th1-checkout-4 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval "render {}"
test th1-render-1 {$RESULT eq {}}

###############################################################################
609
610
611
612
613
614
615

























616
617
618
619
620
621
622
th1-setup {} => TH_OK<br />
this is a trace message.
------------------- END TRACE LOG -------------------}}
}

###############################################################################


























fossil test-th-eval "getParameter"
test th1-get-parameter-1 {$RESULT eq \
    {TH_ERROR: wrong # args: should be "getParameter NAME ?DEFAULT?"}}

###############################################################################

fossil test-th-eval "getParameter test1"







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
th1-setup {} => TH_OK<br />
this is a trace message.
------------------- END TRACE LOG -------------------}}
}

###############################################################################

fossil test-th-eval "styleHeader {Page Title Here}"
test th1-header-1 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "styleHeader {Page Title Here}"
test th1-header-2 {[regexp -- {<title>Fossil: Page Title Here</title>} $RESULT]}

###############################################################################

fossil test-th-eval "styleFooter"
test th1-footer-1 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "styleFooter"
test th1-footer-2 {$RESULT eq {}}

###############################################################################

fossil test-th-eval --open-config --cgi "styleHeader {}; styleFooter"
test th1-footer-3 {[regexp -- {</body></html>} $RESULT]}

###############################################################################

fossil test-th-eval "getParameter"
test th1-get-parameter-1 {$RESULT eq \
    {TH_ERROR: wrong # args: should be "getParameter NAME ?DEFAULT?"}}

###############################################################################

fossil test-th-eval "getParameter test1"
661
662
663
664
665
666
667














































668





669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694





695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
###############################################################################

fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4"
test th1-set-parameter-7 {$RESULT eq {value5}}

###############################################################################















































fossil test-th-eval "globalState checkout"





test th1-globalState-1 {$RESULT eq [fossil test-th-eval checkout]}

###############################################################################

fossil test-th-eval "globalState configuration"
test th1-globalState-2 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval --open-config "globalState configuration"
test th1-globalState-3 {[string length $RESULT] > 0}

###############################################################################

fossil test-th-eval "globalState executable"
test th1-globalState-4 {[file rootname [file tail $RESULT]] eq "fossil"}

###############################################################################

fossil test-th-eval "globalState log"
test th1-globalState-5 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval --errorlog foserrors.log "globalState log"
test th1-globalState-6 {$RESULT eq "foserrors.log"}






###############################################################################

fossil test-th-eval "globalState repository"
test th1-globalState-7 {$RESULT eq [fossil test-th-eval repository]}

###############################################################################

fossil test-th-eval "globalState top"
test th1-globalState-8 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval "globalState user"
test th1-globalState-9 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval --user fossil-th1-test "globalState user"
test th1-globalState-10 {$RESULT eq "fossil-th1-test"}

###############################################################################

fossil test-th-eval "globalState vfs"
test th1-globalState-11 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval "globalState vfs"
test th1-globalState-12 {[string length $RESULT] == 0}

###############################################################################

if {$tcl_platform(platform) eq "windows"} then {
  set altVfs win32-longpath
} else {
  set altVfs unix-dotfile
}

###############################################################################

fossil test-th-eval --vfs $altVfs "globalState vfs"
test th1-globalState-13 {$RESULT eq $altVfs}

###############################################################################

fossil test-th-eval "globalState flags"
test th1-globalState-14 {$RESULT eq "0"}

###############################################################################

fossil test-th-eval "reinitialize; globalState configuration"
test th1-reinitialize-1 {$RESULT eq ""}

###############################################################################

fossil test-th-eval "reinitialize 1; globalState configuration"
test th1-reinitialize-2 {$RESULT ne ""}

###############################################################################

#
# NOTE: This test may fail if the command names do not always come
#       out in a deterministic order from TH1.
#
#fossil test-th-eval "info commands"
#test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\
#enable_output uplevel http expr glob_match utime styleFooter catch if\
#tclReady searchable reinitialize combobox lindex query html anoncap randhex\
#llength for set break regexp markdown styleHeader puts return checkout\
#decorate artifact trace wiki proc hascap globalState continue getParameter\
#hasfeature setting lsearch breakpoint upvar render repository string unset\
#setParameter list error info rename anycap httpize}}

###############################################################################

fossil test-th-eval "info vars"
test th1-info-vars-1 {$RESULT eq ""}

###############################################################################







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
|




|




|




|




|




|
>
>
>
>
>




|




|




|




|




|




|












|




|

















|
|
|
|
|
|
|
|







709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
###############################################################################

fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4"
test th1-set-parameter-7 {$RESULT eq {value5}}

###############################################################################

fossil test-th-eval "artifact"
test th1-artifact-1 {$RESULT eq \
    {TH_ERROR: wrong # args: should be "artifact ID ?FILENAME?"}}

###############################################################################

fossil test-th-eval "artifact tip"
test th1-artifact-2 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "artifact tip"
test th1-artifact-3 {[regexp -- {F test/th1\.test [0-9a-f]{40}} $RESULT]}

###############################################################################

fossil test-th-eval "artifact 0000000000"
test th1-artifact-4 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "artifact 0000000000"
test th1-artifact-5 {$RESULT eq {TH_ERROR: name not found}}

###############################################################################

fossil test-th-eval "artifact tip test/th1.test"
test th1-artifact-6 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "artifact tip test/th1.test"
test th1-artifact-7 {[regexp -- {th1-artifact-7} $RESULT]}

###############################################################################

fossil test-th-eval "artifact 0000000000 test/th1.test"
test th1-artifact-8 {$RESULT eq {TH_ERROR: repository unavailable}}

###############################################################################

fossil test-th-eval --open-config "artifact 0000000000 test/th1.test"
test th1-artifact-9 {$RESULT eq {TH_ERROR: manifest not found}}

###############################################################################

fossil test-th-eval "globalState checkout"
test th1-globalState-1 {[string length $RESULT] > 0}

###############################################################################

fossil test-th-eval "globalState checkout"
test th1-globalState-2 {$RESULT eq [fossil test-th-eval checkout]}

###############################################################################

fossil test-th-eval "globalState configuration"
test th1-globalState-3 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval --open-config "globalState configuration"
test th1-globalState-4 {[string length $RESULT] > 0}

###############################################################################

fossil test-th-eval "globalState executable"
test th1-globalState-5 {[file rootname [file tail $RESULT]] eq "fossil"}

###############################################################################

fossil test-th-eval "globalState log"
test th1-globalState-6 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval --errorlog foserrors.log "globalState log"
test th1-globalState-7 {$RESULT eq "foserrors.log"}

###############################################################################

fossil test-th-eval "globalState repository"
test th1-globalState-8 {[string length $RESULT] > 0}

###############################################################################

fossil test-th-eval "globalState repository"
test th1-globalState-9 {$RESULT eq [fossil test-th-eval repository]}

###############################################################################

fossil test-th-eval "globalState top"
test th1-globalState-10 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval "globalState user"
test th1-globalState-11 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval --user fossil-th1-test "globalState user"
test th1-globalState-12 {$RESULT eq "fossil-th1-test"}

###############################################################################

fossil test-th-eval "globalState vfs"
test th1-globalState-13 {[string length $RESULT] == 0}

###############################################################################

fossil test-th-eval "globalState vfs"
test th1-globalState-14 {[string length $RESULT] == 0}

###############################################################################

if {$tcl_platform(platform) eq "windows"} then {
  set altVfs win32-longpath
} else {
  set altVfs unix-dotfile
}

###############################################################################

fossil test-th-eval --vfs $altVfs "globalState vfs"
test th1-globalState-15 {$RESULT eq $altVfs}

###############################################################################

fossil test-th-eval "globalState flags"
test th1-globalState-16 {$RESULT eq "0"}

###############################################################################

fossil test-th-eval "reinitialize; globalState configuration"
test th1-reinitialize-1 {$RESULT eq ""}

###############################################################################

fossil test-th-eval "reinitialize 1; globalState configuration"
test th1-reinitialize-2 {$RESULT ne ""}

###############################################################################

#
# NOTE: This test may fail if the command names do not always come
#       out in a deterministic order from TH1.
#
fossil test-th-eval "info commands"
test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\
enable_output uplevel dir http expr glob_match utime styleFooter catch if\
tclReady searchable reinitialize combobox lindex query html anoncap randhex\
llength for set break regexp markdown styleHeader puts return checkout\
decorate artifact trace wiki proc hascap globalState continue getParameter\
hasfeature setting lsearch breakpoint upvar render repository string unset\
setParameter list error info rename anycap httpize}}

###############################################################################

fossil test-th-eval "info vars"
test th1-info-vars-1 {$RESULT eq ""}

###############################################################################