|
1
|
# |
|
2
|
# Copyright (c) 2011 D. Richard Hipp |
|
3
|
# Copyright (c) 2015 Ch. Drexler |
|
4
|
# |
|
5
|
# This program is free software; you can redistribute it and/or |
|
6
|
# modify it under the terms of the Simplified BSD License (also |
|
7
|
# known as the "2-Clause License" or "FreeBSD License".) |
|
8
|
# |
|
9
|
# This program is distributed in the hope that it will be useful, |
|
10
|
# but without any warranty; without even the implied warranty of |
|
11
|
# merchantability or fitness for a particular purpose. |
|
12
|
# |
|
13
|
# Author contact information: |
|
14
|
# [email protected] |
|
15
|
# http://www.hwaci.com/drh/ |
|
16
|
# |
|
17
|
# Chris Drexler <[email protected]> |
|
18
|
# |
|
19
|
############################################################################ |
|
20
|
# |
|
21
|
# TH1 tests that may modify the repository |
|
22
|
# |
|
23
|
|
|
24
|
set path [file dirname [info script]] |
|
25
|
|
|
26
|
require_no_open_checkout |
|
27
|
|
|
28
|
######################################## |
|
29
|
# Setup: Add Files and Commit # |
|
30
|
######################################## |
|
31
|
|
|
32
|
test_setup; set rootDir [file normalize [pwd]] |
|
33
|
|
|
34
|
write_file f1.md "f1" |
|
35
|
write_file f2.md "f2" |
|
36
|
write_file f3.txt "f3" |
|
37
|
write_file f4.md "f4" |
|
38
|
|
|
39
|
file mkdir [file join $rootDir subdirA] |
|
40
|
# NOTE: There are no files in subdirA. |
|
41
|
|
|
42
|
file mkdir [file join $rootDir subdirB] |
|
43
|
write_file [file join $rootDir subdirB f5.md] "f5" |
|
44
|
write_file [file join $rootDir subdirB f6.md] "f6" |
|
45
|
write_file [file join $rootDir subdirB f7.txt] "f7" |
|
46
|
write_file [file join $rootDir subdirB f8.md] "f8" |
|
47
|
write_file [file join $rootDir subdirB f9.wiki] "f9" |
|
48
|
|
|
49
|
file mkdir [file join $rootDir subdirC] |
|
50
|
write_file [file join $rootDir subdirC f10.md] "f10" |
|
51
|
write_file [file join $rootDir subdirC f11t.xt] "f11" |
|
52
|
|
|
53
|
set files_md [list subdirB/f5.md subdirB/f6.md subdirB/f8.md subdirC/f10.md] |
|
54
|
|
|
55
|
fossil add $rootDir |
|
56
|
fossil commit -m "c1" |
|
57
|
|
|
58
|
############################################################################### |
|
59
|
|
|
60
|
fossil test-th-eval --open-config "dir trunk subdir*/*.md" |
|
61
|
test th1-dir-1 {[llength $RESULT] eq [llength $files_md]} |
|
62
|
|
|
63
|
set n 1 |
|
64
|
foreach i $RESULT j $files_md { |
|
65
|
test th1-dir-2.$n {$i eq $j} |
|
66
|
set n [expr {$n + 1}] |
|
67
|
} |
|
68
|
|
|
69
|
############################################################################### |
|
70
|
|
|
71
|
set dateTime {\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}} |
|
72
|
fossil test-th-eval --open-config "dir trunk subdir*/*.md 1" |
|
73
|
test th1-dir-3.1 {[lindex [lindex $RESULT 0] 0] eq "subdirB/f5.md"} |
|
74
|
test th1-dir-3.2 {[lindex [lindex $RESULT 0] 1] == 2} |
|
75
|
test th1-dir-3.3 {[regexp -- $dateTime [lindex [lindex $RESULT 0] 2]]} |
|
76
|
test th1-dir-3.4 {[lindex [lindex $RESULT 1] 0] eq "subdirB/f6.md"} |
|
77
|
test th1-dir-3.5 {[lindex [lindex $RESULT 1] 1] == 2} |
|
78
|
test th1-dir-3.6 {[regexp -- $dateTime [lindex [lindex $RESULT 1] 2]]} |
|
79
|
test th1-dir-3.7 {[lindex [lindex $RESULT 2] 0] eq "subdirB/f8.md"} |
|
80
|
test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2} |
|
81
|
test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]} |
|
82
|
test th1-dir-3.10 {[lindex [lindex $RESULT 3] 0] eq "subdirC/f10.md"} |
|
83
|
test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3} |
|
84
|
test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]} |
|
85
|
|
|
86
|
############################################################################### |
|
87
|
|
|
88
|
test_cleanup |
|
89
|
|