Skip to content

Commit 3a8264b

Browse files
committed
Improve local config list and set handling
[e2e/test_config_local_list_get_set.sh] - Add a temporary directory and git init to the test script - Add checks to ensure the output of `gptcommit config list` is valid TOML - Add checks to ensure the default value is returned when deleting a local configuration setting
1 parent 1835ac4 commit 3a8264b

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed
Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
#!/bin/sh
22
set -eu
33

4-
gptcommit config list
5-
# assert is valid TOML
4+
export TEMPDIR=$(mktemp -d)
5+
(
6+
cd "${TEMPDIR}"
7+
git init
68

7-
gptcommit config get openai.model
8-
# assert default = text-davinci-003
9-
gptcommit config set --local openai.model foo
10-
gptcommit config set openai.model bar
11-
gptcommit config get openai.model
12-
# assert is foo
9+
gptcommit config list
10+
# assert is valid TOML
1311

14-
gptcommit config delete openai.model
15-
gptcommit config get openai.model
16-
# assert still is foo
17-
gptcommit config delete --local openai.model
18-
gptcommit config get openai.model
19-
# assert is default
12+
gptcommit config get openai.model
13+
# assert default = text-davinci-003
14+
gptcommit config set --local openai.model foo
15+
gptcommit config set openai.model bar
16+
gptcommit config get openai.model
17+
# assert is foo
18+
19+
gptcommit config delete openai.model
20+
gptcommit config get openai.model
21+
# assert still is foo
22+
gptcommit config delete --local openai.model
23+
gptcommit config get openai.model
24+
# assert is default
25+
)
26+
rm -rf "${TEMPDIR}"

0 commit comments

Comments
 (0)