| | @@ -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 |