Fossil SCM

Add extensive tests for the 'settings' and 'unset' commands. Also, add --exact option to the 'settings' / 'unset' commands.

mistachkin 2016-08-23 17:30 trunk merge
Commit 816bc43b8064bf4db40f96d71ba490a3941d6923
+11 -2
--- src/db.c
+++ src/db.c
@@ -2881,16 +2881,20 @@
28812881
**
28822882
** Options:
28832883
** --global set or unset the given property globally instead of
28842884
** setting or unsetting it for the open repository only.
28852885
**
2886
+** --exact only consider exact name matches.
2887
+**
28862888
** See also: configuration
28872889
*/
28882890
void setting_cmd(void){
28892891
int i;
28902892
int globalFlag = find_option("global","g",0)!=0;
2893
+ int exactFlag = find_option("exact",0,0)!=0;
28912894
int unsetFlag = g.argv[1][0]=='u';
2895
+ verify_all_options();
28922896
db_open_config(1, 0);
28932897
if( !globalFlag ){
28942898
db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
28952899
}
28962900
if( !g.repositoryOpen ){
@@ -2916,11 +2920,11 @@
29162920
print_setting(&aSetting[i]);
29172921
}
29182922
}else if( g.argc==3 || g.argc==4 ){
29192923
const char *zName = g.argv[2];
29202924
int n = (int)strlen(zName);
2921
- const Setting *pSetting = db_find_setting(zName, 1);
2925
+ const Setting *pSetting = db_find_setting(zName, !exactFlag);
29222926
if( pSetting==0 ){
29232927
fossil_fatal("no such setting: %s", zName);
29242928
}
29252929
if( globalFlag && fossil_strcmp(pSetting->name, "manifest")==0 ){
29262930
fossil_fatal("cannot set 'manifest' globally");
@@ -2949,11 +2953,16 @@
29492953
}
29502954
if( isManifest && g.localOpen ){
29512955
manifest_to_disk(db_lget_int("checkout", 0));
29522956
}
29532957
}else{
2954
- while( pSetting->name && fossil_strncmp(pSetting->name,zName,n)==0 ){
2958
+ while( pSetting->name ){
2959
+ if( exactFlag ){
2960
+ if( fossil_strcmp(pSetting->name,zName)!=0 ) break;
2961
+ }else{
2962
+ if( fossil_strncmp(pSetting->name,zName,n)!=0 ) break;
2963
+ }
29552964
print_setting(pSetting);
29562965
pSetting++;
29572966
}
29582967
}
29592968
}else{
29602969
29612970
ADDED test/settings-repo.test
29622971
ADDED test/settings.test
--- src/db.c
+++ src/db.c
@@ -2881,16 +2881,20 @@
2881 **
2882 ** Options:
2883 ** --global set or unset the given property globally instead of
2884 ** setting or unsetting it for the open repository only.
2885 **
 
 
2886 ** See also: configuration
2887 */
2888 void setting_cmd(void){
2889 int i;
2890 int globalFlag = find_option("global","g",0)!=0;
 
2891 int unsetFlag = g.argv[1][0]=='u';
 
2892 db_open_config(1, 0);
2893 if( !globalFlag ){
2894 db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
2895 }
2896 if( !g.repositoryOpen ){
@@ -2916,11 +2920,11 @@
2916 print_setting(&aSetting[i]);
2917 }
2918 }else if( g.argc==3 || g.argc==4 ){
2919 const char *zName = g.argv[2];
2920 int n = (int)strlen(zName);
2921 const Setting *pSetting = db_find_setting(zName, 1);
2922 if( pSetting==0 ){
2923 fossil_fatal("no such setting: %s", zName);
2924 }
2925 if( globalFlag && fossil_strcmp(pSetting->name, "manifest")==0 ){
2926 fossil_fatal("cannot set 'manifest' globally");
@@ -2949,11 +2953,16 @@
2949 }
2950 if( isManifest && g.localOpen ){
2951 manifest_to_disk(db_lget_int("checkout", 0));
2952 }
2953 }else{
2954 while( pSetting->name && fossil_strncmp(pSetting->name,zName,n)==0 ){
 
 
 
 
 
2955 print_setting(pSetting);
2956 pSetting++;
2957 }
2958 }
2959 }else{
2960
2961 DDED test/settings-repo.test
2962 DDED test/settings.test
--- src/db.c
+++ src/db.c
@@ -2881,16 +2881,20 @@
2881 **
2882 ** Options:
2883 ** --global set or unset the given property globally instead of
2884 ** setting or unsetting it for the open repository only.
2885 **
2886 ** --exact only consider exact name matches.
2887 **
2888 ** See also: configuration
2889 */
2890 void setting_cmd(void){
2891 int i;
2892 int globalFlag = find_option("global","g",0)!=0;
2893 int exactFlag = find_option("exact",0,0)!=0;
2894 int unsetFlag = g.argv[1][0]=='u';
2895 verify_all_options();
2896 db_open_config(1, 0);
2897 if( !globalFlag ){
2898 db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
2899 }
2900 if( !g.repositoryOpen ){
@@ -2916,11 +2920,11 @@
2920 print_setting(&aSetting[i]);
2921 }
2922 }else if( g.argc==3 || g.argc==4 ){
2923 const char *zName = g.argv[2];
2924 int n = (int)strlen(zName);
2925 const Setting *pSetting = db_find_setting(zName, !exactFlag);
2926 if( pSetting==0 ){
2927 fossil_fatal("no such setting: %s", zName);
2928 }
2929 if( globalFlag && fossil_strcmp(pSetting->name, "manifest")==0 ){
2930 fossil_fatal("cannot set 'manifest' globally");
@@ -2949,11 +2953,16 @@
2953 }
2954 if( isManifest && g.localOpen ){
2955 manifest_to_disk(db_lget_int("checkout", 0));
2956 }
2957 }else{
2958 while( pSetting->name ){
2959 if( exactFlag ){
2960 if( fossil_strcmp(pSetting->name,zName)!=0 ) break;
2961 }else{
2962 if( fossil_strncmp(pSetting->name,zName,n)!=0 ) break;
2963 }
2964 print_setting(pSetting);
2965 pSetting++;
2966 }
2967 }
2968 }else{
2969
2970 DDED test/settings-repo.test
2971 DDED test/settings.test
+11 -2
--- src/db.c
+++ src/db.c
@@ -2881,16 +2881,20 @@
28812881
**
28822882
** Options:
28832883
** --global set or unset the given property globally instead of
28842884
** setting or unsetting it for the open repository only.
28852885
**
2886
+** --exact only consider exact name matches.
2887
+**
28862888
** See also: configuration
28872889
*/
28882890
void setting_cmd(void){
28892891
int i;
28902892
int globalFlag = find_option("global","g",0)!=0;
2893
+ int exactFlag = find_option("exact",0,0)!=0;
28912894
int unsetFlag = g.argv[1][0]=='u';
2895
+ verify_all_options();
28922896
db_open_config(1, 0);
28932897
if( !globalFlag ){
28942898
db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
28952899
}
28962900
if( !g.repositoryOpen ){
@@ -2916,11 +2920,11 @@
29162920
print_setting(&aSetting[i]);
29172921
}
29182922
}else if( g.argc==3 || g.argc==4 ){
29192923
const char *zName = g.argv[2];
29202924
int n = (int)strlen(zName);
2921
- const Setting *pSetting = db_find_setting(zName, 1);
2925
+ const Setting *pSetting = db_find_setting(zName, !exactFlag);
29222926
if( pSetting==0 ){
29232927
fossil_fatal("no such setting: %s", zName);
29242928
}
29252929
if( globalFlag && fossil_strcmp(pSetting->name, "manifest")==0 ){
29262930
fossil_fatal("cannot set 'manifest' globally");
@@ -2949,11 +2953,16 @@
29492953
}
29502954
if( isManifest && g.localOpen ){
29512955
manifest_to_disk(db_lget_int("checkout", 0));
29522956
}
29532957
}else{
2954
- while( pSetting->name && fossil_strncmp(pSetting->name,zName,n)==0 ){
2958
+ while( pSetting->name ){
2959
+ if( exactFlag ){
2960
+ if( fossil_strcmp(pSetting->name,zName)!=0 ) break;
2961
+ }else{
2962
+ if( fossil_strncmp(pSetting->name,zName,n)!=0 ) break;
2963
+ }
29552964
print_setting(pSetting);
29562965
pSetting++;
29572966
}
29582967
}
29592968
}else{
29602969
29612970
ADDED test/settings-repo.test
29622971
ADDED test/settings.test
--- src/db.c
+++ src/db.c
@@ -2881,16 +2881,20 @@
2881 **
2882 ** Options:
2883 ** --global set or unset the given property globally instead of
2884 ** setting or unsetting it for the open repository only.
2885 **
 
 
2886 ** See also: configuration
2887 */
2888 void setting_cmd(void){
2889 int i;
2890 int globalFlag = find_option("global","g",0)!=0;
 
2891 int unsetFlag = g.argv[1][0]=='u';
 
2892 db_open_config(1, 0);
2893 if( !globalFlag ){
2894 db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
2895 }
2896 if( !g.repositoryOpen ){
@@ -2916,11 +2920,11 @@
2916 print_setting(&aSetting[i]);
2917 }
2918 }else if( g.argc==3 || g.argc==4 ){
2919 const char *zName = g.argv[2];
2920 int n = (int)strlen(zName);
2921 const Setting *pSetting = db_find_setting(zName, 1);
2922 if( pSetting==0 ){
2923 fossil_fatal("no such setting: %s", zName);
2924 }
2925 if( globalFlag && fossil_strcmp(pSetting->name, "manifest")==0 ){
2926 fossil_fatal("cannot set 'manifest' globally");
@@ -2949,11 +2953,16 @@
2949 }
2950 if( isManifest && g.localOpen ){
2951 manifest_to_disk(db_lget_int("checkout", 0));
2952 }
2953 }else{
2954 while( pSetting->name && fossil_strncmp(pSetting->name,zName,n)==0 ){
 
 
 
 
 
2955 print_setting(pSetting);
2956 pSetting++;
2957 }
2958 }
2959 }else{
2960
2961 DDED test/settings-repo.test
2962 DDED test/settings.test
--- src/db.c
+++ src/db.c
@@ -2881,16 +2881,20 @@
2881 **
2882 ** Options:
2883 ** --global set or unset the given property globally instead of
2884 ** setting or unsetting it for the open repository only.
2885 **
2886 ** --exact only consider exact name matches.
2887 **
2888 ** See also: configuration
2889 */
2890 void setting_cmd(void){
2891 int i;
2892 int globalFlag = find_option("global","g",0)!=0;
2893 int exactFlag = find_option("exact",0,0)!=0;
2894 int unsetFlag = g.argv[1][0]=='u';
2895 verify_all_options();
2896 db_open_config(1, 0);
2897 if( !globalFlag ){
2898 db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
2899 }
2900 if( !g.repositoryOpen ){
@@ -2916,11 +2920,11 @@
2920 print_setting(&aSetting[i]);
2921 }
2922 }else if( g.argc==3 || g.argc==4 ){
2923 const char *zName = g.argv[2];
2924 int n = (int)strlen(zName);
2925 const Setting *pSetting = db_find_setting(zName, !exactFlag);
2926 if( pSetting==0 ){
2927 fossil_fatal("no such setting: %s", zName);
2928 }
2929 if( globalFlag && fossil_strcmp(pSetting->name, "manifest")==0 ){
2930 fossil_fatal("cannot set 'manifest' globally");
@@ -2949,11 +2953,16 @@
2953 }
2954 if( isManifest && g.localOpen ){
2955 manifest_to_disk(db_lget_int("checkout", 0));
2956 }
2957 }else{
2958 while( pSetting->name ){
2959 if( exactFlag ){
2960 if( fossil_strcmp(pSetting->name,zName)!=0 ) break;
2961 }else{
2962 if( fossil_strncmp(pSetting->name,zName,n)!=0 ) break;
2963 }
2964 print_setting(pSetting);
2965 pSetting++;
2966 }
2967 }
2968 }else{
2969
2970 DDED test/settings-repo.test
2971 DDED test/settings.test
--- a/test/settings-repo.test
+++ b/test/settings-repo.test
@@ -0,0 +1,164 @@
1
+#
2
+# Copyright (c) 2016 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
+# The "settings" and "unset" commands that may modify the repository.
19
+#
20
+
21
+le dirname [info script]]set dir [file dirname [info script]]; test_setup
22
+
23
+###############################################################################
24
+#
25
+# Complete syntax as tested:
26
+#
27
+# fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
28
+# fossil unset PROPERTY ?OPTIONS?
29
+#
30
+# Where the only supported options are "--global" and "--exact".
31
+#
32
+###############################################################################
33
+
34
+set all_settings [get_all_settings]
35
+
36
+foreach name $all_settings {
37
+ #
38
+ # HACK: Make 100% sure that there are no non-default setting values
39
+ # present anywhere.
40
+ #
41
+ ame --exact --global
42
+ }
43
+ --global
44
+ fossil unset $name --exact
45
+
46
+ #
47
+ # NOTE: Query for the hard-coded default value of this setting and
48
+ # save it.
49
+ #
50
+ fossil test-th-eval "setting $name"
51
+ set defaults($name) [normalize_result]
52
+}
53
+
54
+###############################################################################
55
+
56
+fossil setting some_value -expectError
57
+
58
+test settings-set-bad-local {
59
+ [normalize_result] eq "no such setting: bad-setting"
60
+}
61
+
62
+fossil settings bad-ing some_value -expectError
63
+
64
+test settings-set-bad-global {
65
+ [normalize_result] eq "no such setting: bad-setting"
66
+}
67
+
68
+###################################################tting --global -expectErrod Hipp
69
+#
70
+# This program is free software; you can redistribute it and/or
71
+# modify it under the term#
72
+# Copyright (c) 2016 D. Richard Hipp
73
+#
74
+# This program is free software; you can redistribute it and/or
75
+# modify it under the terms of the Simplified BSD License (also
76
+# known as the "2-Clause License" oing some_value -expe########################################################################
77
+#
78
+# Complete syntax as tested:
79
+#
80
+# fossil settings ?PROPERTY? ?VALUE? ?OPTIONSing some_value -expeTIONS?
81
+#
82
+# Where the only supported options are "--global" and "--exact".
83
+#
84
+###############################################################################
85
+
86
+set all_settings [get_all_settings]
87
+
88
+foreach name $all_setting --global -expect########################################################################
89
+#
90
+# Complete syntax as unset ssl --globaltting --global -expectTIONS?
91
+#
92
+# Where the only supported options are "--global" and "--exact".
93
+#
94
+###############################################################################
95
+
96
+set all_settings [get_all_settings]
97
+
98
+fore$name"
99
+ set defaults($name) [normalize_result]
100
+}
101
+
102
+###############################################################################
103
+
104
+fossil settings bad-setting some_value -expectError
105
+
106
+test settings-set-bad-local {
107
+ [normalize_result] eq "no such setting: bad-setting"
108
+}
109
+
110
+fossil settings bad-setting some_value --global -expectError
111
+
112
+test settings-set-bad-global {
113
+ [normalize_result] eq "no such setting: bad-setting"
114
+}
115
+
116
+###############################################################################
117
+
118
+fossil unset bad-setting -expectError
119
+
120
+test settings-unset-bad-local {
121
+ [normalize_result] eq "no such setting: bad-setting"
122
+}
123
+
124
+fossil unset bad-setting --global -expectError
125
+
126
+test settings-unset-bad-global {
127
+ [normalize_result] eq "no such setting: bad-setting"
128
+}
129
+
130
+###############################################################################
131
+
132
+fossil settings ssl some_value -expectError
133
+
134
+test settings-set-ambiguous-local {
135
+ [normalize_result] eq
136
+ "ambiguous setting \"ssl\" - might be: ssl-ca-location ssl-identity"
137
+}
138
+
139
+fossil settings ssl some_value --global -expectError
140
+
141
+test settings-set-ambiguous-global {
142
+ [normalize_result] eq
143
+ "ambiguous setting \"ssl\" - might be: ssl-ca-location ssl-identity"
144
+}
145
+
146
+###############################################################################
147
+
148
+fossil unset ssl -expectError
149
+
150
+test settings-unset-ambiguous-local {
151
+ [normalize_result] eq
152
+ "ambiguous setting \"ssl\" - might be: ssl-ca-location ssl-identity"
153
+}
154
+
155
+fossil unset ssl --global -expectError
156
+
157
+test settings-unset-ambiguous-global {
158
+ [normalize_result] eq
159
+ "ambiguous setting \"ssl\" - might be: ssl-ca-location ssl-identity"
160
+}
161
+
162
+###############################################################################
163
+
164
+set pattern($value
--- a/test/settings-repo.test
+++ b/test/settings-repo.test
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/test/settings-repo.test
+++ b/test/settings-repo.test
@@ -0,0 +1,164 @@
1 #
2 # Copyright (c) 2016 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 # The "settings" and "unset" commands that may modify the repository.
19 #
20
21 le dirname [info script]]set dir [file dirname [info script]]; test_setup
22
23 ###############################################################################
24 #
25 # Complete syntax as tested:
26 #
27 # fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
28 # fossil unset PROPERTY ?OPTIONS?
29 #
30 # Where the only supported options are "--global" and "--exact".
31 #
32 ###############################################################################
33
34 set all_settings [get_all_settings]
35
36 foreach name $all_settings {
37 #
38 # HACK: Make 100% sure that there are no non-default setting values
39 # present anywhere.
40 #
41 ame --exact --global
42 }
43 --global
44 fossil unset $name --exact
45
46 #
47 # NOTE: Query for the hard-coded default value of this setting and
48 # save it.
49 #
50 fossil test-th-eval "setting $name"
51 set defaults($name) [normalize_result]
52 }
53
54 ###############################################################################
55
56 fossil setting some_value -expectError
57
58 test settings-set-bad-local {
59 [normalize_result] eq "no such setting: bad-setting"
60 }
61
62 fossil settings bad-ing some_value -expectError
63
64 test settings-set-bad-global {
65 [normalize_result] eq "no such setting: bad-setting"
66 }
67
68 ###################################################tting --global -expectErrod Hipp
69 #
70 # This program is free software; you can redistribute it and/or
71 # modify it under the term#
72 # Copyright (c) 2016 D. Richard Hipp
73 #
74 # This program is free software; you can redistribute it and/or
75 # modify it under the terms of the Simplified BSD License (also
76 # known as the "2-Clause License" oing some_value -expe########################################################################
77 #
78 # Complete syntax as tested:
79 #
80 # fossil settings ?PROPERTY? ?VALUE? ?OPTIONSing some_value -expeTIONS?
81 #
82 # Where the only supported options are "--global" and "--exact".
83 #
84 ###############################################################################
85
86 set all_settings [get_all_settings]
87
88 foreach name $all_setting --global -expect########################################################################
89 #
90 # Complete syntax as unset ssl --globaltting --global -expectTIONS?
91 #
92 # Where the only supported options are "--global" and "--exact".
93 #
94 ###############################################################################
95
96 set all_settings [get_all_settings]
97
98 fore$name"
99 set defaults($name) [normalize_result]
100 }
101
102 ###############################################################################
103
104 fossil settings bad-setting some_value -expectError
105
106 test settings-set-bad-local {
107 [normalize_result] eq "no such setting: bad-setting"
108 }
109
110 fossil settings bad-setting some_value --global -expectError
111
112 test settings-set-bad-global {
113 [normalize_result] eq "no such setting: bad-setting"
114 }
115
116 ###############################################################################
117
118 fossil unset bad-setting -expectError
119
120 test settings-unset-bad-local {
121 [normalize_result] eq "no such setting: bad-setting"
122 }
123
124 fossil unset bad-setting --global -expectError
125
126 test settings-unset-bad-global {
127 [normalize_result] eq "no such setting: bad-setting"
128 }
129
130 ###############################################################################
131
132 fossil settings ssl some_value -expectError
133
134 test settings-set-ambiguous-local {
135 [normalize_result] eq
136 "ambiguous setting \"ssl\" - might be: ssl-ca-location ssl-identity"
137 }
138
139 fossil settings ssl some_value --global -expectError
140
141 test settings-set-ambiguous-global {
142 [normalize_result] eq
143 "ambiguous setting \"ssl\" - might be: ssl-ca-location ssl-identity"
144 }
145
146 ###############################################################################
147
148 fossil unset ssl -expectError
149
150 test settings-unset-ambiguous-local {
151 [normalize_result] eq
152 "ambiguous setting \"ssl\" - might be: ssl-ca-location ssl-identity"
153 }
154
155 fossil unset ssl --global -expectError
156
157 test settings-unset-ambiguous-global {
158 [normalize_result] eq
159 "ambiguous setting \"ssl\" - might be: ssl-ca-location ssl-identity"
160 }
161
162 ###############################################################################
163
164 set pattern($value
--- a/test/settings.test
+++ b/test/settings.test
@@ -0,0 +1,57 @@
1
+#
2
+# Copyright (c) 2016 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
+# The "settings" andirnset" commands.
19
+#
20
+
21
+set path [file dirname [info script]]; test_setup
22
+
23
+###############################################################################
24
+#
25
+# Complete syntax as tested:
26
+#
27
+# fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
28
+# fossil unset PROPERTY ?OPTIONS?
29
+#
30
+# Where the only supported options are "--global" and "--exact".
31
+#
32
+###############################################################################
33
+#
34
+# NOTE: The [extract_setti"
35
+# commset datail settings
36
+set locetting_names] procedure extracts thed options are "--glrd Hipp
37
+#
38
+# This pr#
39
+# Copyright (c) 2016 D. Richard Hipp
40
+#
41
+# This program is free software; you can redistribute it and/or
42
+# modify it under the terms of the Simplified BSD License (also
43
+# known as the "2-Clause License" or "FreeBSD License".)
44
+#
45
+# This program is distributed in the hope that it will be useful,
46
+# but without any warranty; without even
47
+
48
+ed options are "--glet all_settings [get_alltings]
49
+
50
+fossil settings
51
+set local_settings [extract
52
+
53
+ed options are "--gl[extract_setting_names [normalize_result_no_trim]]
54
+
55
+foreach name $all_settings {
56
+ test settings-have-local-$name {
57
+ [lsearch -exact $l
--- a/test/settings.test
+++ b/test/settings.test
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/test/settings.test
+++ b/test/settings.test
@@ -0,0 +1,57 @@
1 #
2 # Copyright (c) 2016 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 # The "settings" andirnset" commands.
19 #
20
21 set path [file dirname [info script]]; test_setup
22
23 ###############################################################################
24 #
25 # Complete syntax as tested:
26 #
27 # fossil settings ?PROPERTY? ?VALUE? ?OPTIONS?
28 # fossil unset PROPERTY ?OPTIONS?
29 #
30 # Where the only supported options are "--global" and "--exact".
31 #
32 ###############################################################################
33 #
34 # NOTE: The [extract_setti"
35 # commset datail settings
36 set locetting_names] procedure extracts thed options are "--glrd Hipp
37 #
38 # This pr#
39 # Copyright (c) 2016 D. Richard Hipp
40 #
41 # This program is free software; you can redistribute it and/or
42 # modify it under the terms of the Simplified BSD License (also
43 # known as the "2-Clause License" or "FreeBSD License".)
44 #
45 # This program is distributed in the hope that it will be useful,
46 # but without any warranty; without even
47
48 ed options are "--glet all_settings [get_alltings]
49
50 fossil settings
51 set local_settings [extract
52
53 ed options are "--gl[extract_setting_names [normalize_result_no_trim]]
54
55 foreach name $all_settings {
56 test settings-have-local-$name {
57 [lsearch -exact $l
--- test/tester.tcl
+++ test/tester.tcl
@@ -186,10 +186,122 @@
186186
close $out
187187
}
188188
proc write_file_indented {filename txt} {
189189
write_file $filename [string trim [string map [list "\n " \n] $txt]]\n
190190
}
191
+
192
+# Returns the list of all supported versionable settings.
193
+#
194
+proc get_versionable_settings {} {
195
+ #
196
+ # TODO: If the list of supported versionable settings in "db.c" is modified,
197
+ # this list (and procedure) most likely needs to be modified as well.
198
+ #
199
+ set result [list \
200
+ allow-symlinks \
201
+ binary-glob \
202
+ clean-glob \
203
+ crnl-glob \
204
+ dotfiles \
205
+ empty-dirs \
206
+ encoding-glob \
207
+ ignore-glob \
208
+ keep-glob \
209
+ manifest \
210
+ th1-setup \
211
+ th1-uri-regexp]
212
+
213
+ fossil test-th-eval "hasfeature tcl"
214
+
215
+ if {$::RESULT eq "1"} {
216
+ lappend result tcl-setup
217
+ }
218
+
219
+ return $result
220
+}
221
+
222
+# Returns the list of all supported settings.
223
+#
224
+proc get_all_settings {} {
225
+ #
226
+ # TODO: If the list of supported settings in "db.c" is modified, this list
227
+ # (and procedure) most likely needs to be modified as well.
228
+ #
229
+ set result [list \
230
+ access-log \
231
+ admin-log \
232
+ allow-symlinks \
233
+ auto-captcha \
234
+ auto-hyperlink \
235
+ auto-shun \
236
+ autosync \
237
+ autosync-tries \
238
+ binary-glob \
239
+ case-sensitive \
240
+ clean-glob \
241
+ clearsign \
242
+ crnl-glob \
243
+ default-perms \
244
+ diff-binary \
245
+ diff-command \
246
+ dont-push \
247
+ dotfiles \
248
+ editor \
249
+ empty-dirs \
250
+ encoding-glob \
251
+ exec-rel-paths \
252
+ gdiff-command \
253
+ gmerge-command \
254
+ hash-digits \
255
+ http-port \
256
+ https-login \
257
+ ignore-glob \
258
+ keep-glob \
259
+ localauth \
260
+ main-branch \
261
+ manifest \
262
+ max-loadavg \
263
+ max-upload \
264
+ mtime-changes \
265
+ pgp-command \
266
+ proxy \
267
+ relative-paths \
268
+ repo-cksum \
269
+ self-register \
270
+ ssh-command \
271
+ ssl-ca-location \
272
+ ssl-identity \
273
+ th1-setup \
274
+ th1-uri-regexp \
275
+ web-browser]
276
+
277
+ fossil test-th-eval "hasfeature legacyMvRm"
278
+
279
+ if {$::RESULT eq "1"} {
280
+ lappend result mv-rm-files
281
+ }
282
+
283
+ fossil test-th-eval "hasfeature tcl"
284
+
285
+ if {$::RESULT eq "1"} {
286
+ lappend result tcl tcl-setup
287
+ }
288
+
289
+ fossil test-th-eval "hasfeature th1Docs"
290
+
291
+ if {$::RESULT eq "1"} {
292
+ lappend result th1-docs
293
+ }
294
+
295
+ fossil test-th-eval "hasfeature th1Hooks"
296
+
297
+ if {$::RESULT eq "1"} {
298
+ lappend result th1-hooks
299
+ }
300
+
301
+ return [lsort -dictionary $result]
302
+}
191303
192304
# Return true if two files are the same
193305
#
194306
proc same_file {a b} {
195307
set x [read_file $a]
@@ -655,10 +767,15 @@
655767
656768
# fixup the whitespace in the result to make it easier to compare.
657769
proc normalize_result {} {
658770
return [string map [list \r\n \n] [string trim $::RESULT]]
659771
}
772
+
773
+# fixup the line-endings in the result to make it easier to compare.
774
+proc normalize_result_no_trim {} {
775
+ return [string map [list \r\n \n] $::RESULT]
776
+}
660777
661778
# returns the first line of the normalized result.
662779
proc first_data_line {} {
663780
return [lindex [split [normalize_result] \n] 0]
664781
}
665782
--- test/tester.tcl
+++ test/tester.tcl
@@ -186,10 +186,122 @@
186 close $out
187 }
188 proc write_file_indented {filename txt} {
189 write_file $filename [string trim [string map [list "\n " \n] $txt]]\n
190 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
192 # Return true if two files are the same
193 #
194 proc same_file {a b} {
195 set x [read_file $a]
@@ -655,10 +767,15 @@
655
656 # fixup the whitespace in the result to make it easier to compare.
657 proc normalize_result {} {
658 return [string map [list \r\n \n] [string trim $::RESULT]]
659 }
 
 
 
 
 
660
661 # returns the first line of the normalized result.
662 proc first_data_line {} {
663 return [lindex [split [normalize_result] \n] 0]
664 }
665
--- test/tester.tcl
+++ test/tester.tcl
@@ -186,10 +186,122 @@
186 close $out
187 }
188 proc write_file_indented {filename txt} {
189 write_file $filename [string trim [string map [list "\n " \n] $txt]]\n
190 }
191
192 # Returns the list of all supported versionable settings.
193 #
194 proc get_versionable_settings {} {
195 #
196 # TODO: If the list of supported versionable settings in "db.c" is modified,
197 # this list (and procedure) most likely needs to be modified as well.
198 #
199 set result [list \
200 allow-symlinks \
201 binary-glob \
202 clean-glob \
203 crnl-glob \
204 dotfiles \
205 empty-dirs \
206 encoding-glob \
207 ignore-glob \
208 keep-glob \
209 manifest \
210 th1-setup \
211 th1-uri-regexp]
212
213 fossil test-th-eval "hasfeature tcl"
214
215 if {$::RESULT eq "1"} {
216 lappend result tcl-setup
217 }
218
219 return $result
220 }
221
222 # Returns the list of all supported settings.
223 #
224 proc get_all_settings {} {
225 #
226 # TODO: If the list of supported settings in "db.c" is modified, this list
227 # (and procedure) most likely needs to be modified as well.
228 #
229 set result [list \
230 access-log \
231 admin-log \
232 allow-symlinks \
233 auto-captcha \
234 auto-hyperlink \
235 auto-shun \
236 autosync \
237 autosync-tries \
238 binary-glob \
239 case-sensitive \
240 clean-glob \
241 clearsign \
242 crnl-glob \
243 default-perms \
244 diff-binary \
245 diff-command \
246 dont-push \
247 dotfiles \
248 editor \
249 empty-dirs \
250 encoding-glob \
251 exec-rel-paths \
252 gdiff-command \
253 gmerge-command \
254 hash-digits \
255 http-port \
256 https-login \
257 ignore-glob \
258 keep-glob \
259 localauth \
260 main-branch \
261 manifest \
262 max-loadavg \
263 max-upload \
264 mtime-changes \
265 pgp-command \
266 proxy \
267 relative-paths \
268 repo-cksum \
269 self-register \
270 ssh-command \
271 ssl-ca-location \
272 ssl-identity \
273 th1-setup \
274 th1-uri-regexp \
275 web-browser]
276
277 fossil test-th-eval "hasfeature legacyMvRm"
278
279 if {$::RESULT eq "1"} {
280 lappend result mv-rm-files
281 }
282
283 fossil test-th-eval "hasfeature tcl"
284
285 if {$::RESULT eq "1"} {
286 lappend result tcl tcl-setup
287 }
288
289 fossil test-th-eval "hasfeature th1Docs"
290
291 if {$::RESULT eq "1"} {
292 lappend result th1-docs
293 }
294
295 fossil test-th-eval "hasfeature th1Hooks"
296
297 if {$::RESULT eq "1"} {
298 lappend result th1-hooks
299 }
300
301 return [lsort -dictionary $result]
302 }
303
304 # Return true if two files are the same
305 #
306 proc same_file {a b} {
307 set x [read_file $a]
@@ -655,10 +767,15 @@
767
768 # fixup the whitespace in the result to make it easier to compare.
769 proc normalize_result {} {
770 return [string map [list \r\n \n] [string trim $::RESULT]]
771 }
772
773 # fixup the line-endings in the result to make it easier to compare.
774 proc normalize_result_no_trim {} {
775 return [string map [list \r\n \n] $::RESULT]
776 }
777
778 # returns the first line of the normalized result.
779 proc first_data_line {} {
780 return [lindex [split [normalize_result] \n] 0]
781 }
782

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button