From e46b27be77afa0f8ebd6b90bdb883e923d791363 Mon Sep 17 00:00:00 2001 From: KevRiver Date: Thu, 24 Oct 2024 18:03:26 +0900 Subject: [PATCH] add test that triggers the bug(issue#65) and fails --- cmd/humanlog/main_test.go | 24 +++++++++++++++++++++++ test/cases/00065-apply-config/config.json | 3 +++ 2 files changed, 27 insertions(+) create mode 100644 cmd/humanlog/main_test.go create mode 100644 test/cases/00065-apply-config/config.json diff --git a/cmd/humanlog/main_test.go b/cmd/humanlog/main_test.go new file mode 100644 index 00000000..0b9dc2f5 --- /dev/null +++ b/cmd/humanlog/main_test.go @@ -0,0 +1,24 @@ +package main + +import ( + "os" + "strings" + "testing" +) + +func TestApplyConfigFromConfigFile_when_one_of_skip_or_keep_is_given(t *testing.T) { + + wd, _ := os.Getwd() + dirs := strings.Split(wd, "/") + root := strings.Join(dirs[:len(dirs)-2], "/") + configFilePath := root + "/test/cases/00065-apply-config/config.json" + t.Logf("config file path: %v", configFilePath) + + args := []string{"program-path"} + args = append(args, "--config", configFilePath) + + app := newApp() + if err := app.Run(args); err != nil { + t.Fatal(err) + } +} diff --git a/test/cases/00065-apply-config/config.json b/test/cases/00065-apply-config/config.json new file mode 100644 index 00000000..ea54b355 --- /dev/null +++ b/test/cases/00065-apply-config/config.json @@ -0,0 +1,3 @@ +{ + "skip": ["foo", "bar"] +} \ No newline at end of file