|
1
|
# |
|
2
|
# Copyright (c) 2020 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
|
# [email protected] |
|
14
|
# http://www.hwaci.com/drh/ |
|
15
|
# |
|
16
|
############################################################################ |
|
17
|
# |
|
18
|
# Tests for reserved names. |
|
19
|
# |
|
20
|
|
|
21
|
test_setup |
|
22
|
|
|
23
|
############################################################################### |
|
24
|
|
|
25
|
set reserved_names_tests [list \ |
|
26
|
{0 {}} \ |
|
27
|
{0 a.fslckout} \ |
|
28
|
{1 .fslckout} \ |
|
29
|
{1 .FSlckOUT} \ |
|
30
|
{2 a/.fslckout} \ |
|
31
|
{0 .fslckout/b} \ |
|
32
|
{0 fslckout} \ |
|
33
|
{0 .fslckoutx} \ |
|
34
|
{1 _FOSSIL_} \ |
|
35
|
{0 _FOSSIL} \ |
|
36
|
{0 FOSSIL_} \ |
|
37
|
{0 FOSSIL_} \ |
|
38
|
{0 a_FOSSIL_} \ |
|
39
|
{0 _FOSSIL__} \ |
|
40
|
{0 __FOSSIL__} \ |
|
41
|
{0 __FOssIL__} \ |
|
42
|
{0 _FOSSIL_/a} \ |
|
43
|
{2 a/_FOSSIL_} \ |
|
44
|
{2 _FOSSIL_/c/.fslckout} \ |
|
45
|
{2 _FOSSIL_/c/.fslckout/_FOSSIL_} \ |
|
46
|
{0 _FOSSIL_/c/.fslckout/._FOSSIL_t} \ |
|
47
|
{0 _FOSSIL_/c/.fslckout/t._FOSSIL_} \ |
|
48
|
{0 a} \ |
|
49
|
{0 a/b} \ |
|
50
|
{0 a/b/c} \ |
|
51
|
{0 a/b/c/} \ |
|
52
|
{0 a/_FOSSIL/} \ |
|
53
|
{0 a/fslckout/} \ |
|
54
|
{0 a/_fslckout/} \ |
|
55
|
{0 _FOSSIL-wal} \ |
|
56
|
{0 _FOSSIL-shm} \ |
|
57
|
{0 _FOSSIL-journal} \ |
|
58
|
{0 _FOSSIL_-wal/a} \ |
|
59
|
{0 _FOSSIL_-shm/a} \ |
|
60
|
{0 _FOSSIL_-journal/a} \ |
|
61
|
{1 _FOSSIL_-wal} \ |
|
62
|
{1 _FOSSIL_-shm} \ |
|
63
|
{1 _FOSSIL_-journal} \ |
|
64
|
{2 a/_FOSSIL_-wal} \ |
|
65
|
{2 a/_FOSSIL_-shm} \ |
|
66
|
{2 a/_FOSSIL_-journal} \ |
|
67
|
{0 .fslckout-wal/a} \ |
|
68
|
{0 .fslckout-shm/a} \ |
|
69
|
{0 .fslckout-journal/a} \ |
|
70
|
{1 .fslckout-wal} \ |
|
71
|
{1 .fslckout-shm} \ |
|
72
|
{1 .fslckout-journal} \ |
|
73
|
{2 a/.fslckout-wal} \ |
|
74
|
{2 a/.fslckout-shm} \ |
|
75
|
{2 a/.fslckout-journal} \ |
|
76
|
] |
|
77
|
|
|
78
|
############################################################################### |
|
79
|
|
|
80
|
set testNo 0 |
|
81
|
|
|
82
|
foreach reserved_names_test $reserved_names_tests { |
|
83
|
incr testNo |
|
84
|
|
|
85
|
set reserved_result [lindex $reserved_names_test 0] |
|
86
|
set reserved_name [lindex $reserved_names_test 1] |
|
87
|
|
|
88
|
fossil test-is-reserved-name $reserved_name |
|
89
|
|
|
90
|
test reserved-result-$testNo { |
|
91
|
[lindex [normalize_result] 0] eq $reserved_result |
|
92
|
} |
|
93
|
|
|
94
|
test reserved-name-$testNo { |
|
95
|
[lindex [normalize_result] 1] eq $reserved_name |
|
96
|
} |
|
97
|
|
|
98
|
fossil test-is-reserved-name [string toupper $reserved_name] |
|
99
|
|
|
100
|
test reserved-result-upper-$testNo { |
|
101
|
[lindex [normalize_result] 0] eq $reserved_result |
|
102
|
} |
|
103
|
|
|
104
|
test reserved-name-upper-$testNo { |
|
105
|
[lindex [normalize_result] 1] eq [string toupper $reserved_name] |
|
106
|
} |
|
107
|
|
|
108
|
fossil test-is-reserved-name [string tolower $reserved_name] |
|
109
|
|
|
110
|
test reserved-result-lower-$testNo { |
|
111
|
[lindex [normalize_result] 0] eq $reserved_result |
|
112
|
} |
|
113
|
|
|
114
|
test reserved-name-lower-$testNo { |
|
115
|
[lindex [normalize_result] 1] eq [string tolower $reserved_name] |
|
116
|
} |
|
117
|
} |
|
118
|
|
|
119
|
############################################################################### |
|
120
|
|
|
121
|
test_cleanup |
|
122
|
|