From 9915b0c4a6a89d4e5c715d3534c16c5a1f9e7cae Mon Sep 17 00:00:00 2001 From: zongz Date: Fri, 8 Nov 2024 17:00:50 +0800 Subject: [PATCH] fix: fix unit test Signed-off-by: zongz --- pkg/options/run_test.go | 4 ++-- pkg/options/testdata/run_opt/file1.k | 1 + pkg/options/testdata/run_opt/file2.k | 1 + pkg/options/testdata/run_opt/file3.k | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 pkg/options/testdata/run_opt/file1.k create mode 100644 pkg/options/testdata/run_opt/file2.k create mode 100644 pkg/options/testdata/run_opt/file3.k diff --git a/pkg/options/run_test.go b/pkg/options/run_test.go index 2028ab4..d83e6d4 100644 --- a/pkg/options/run_test.go +++ b/pkg/options/run_test.go @@ -108,14 +108,14 @@ spec: func TestRunOptions_Complete(t *testing.T) { options := NewRunOptions() - args := []string{"file1.k", "file2.k", "file3.k"} + args := []string{"./testdata/run_opt/file1.k", "./testdata/run_opt/file2.k", "./testdata/run_opt/file3.k"} err := options.Complete(args) if err != nil { t.Errorf("RunOptions.Complete() failed: %v", err) } - expectedEntries := []string{"file1.k", "file2.k", "file3.k"} + expectedEntries := []string{"./testdata/run_opt/file1.k", "./testdata/run_opt/file2.k", "./testdata/run_opt/file3.k"} if len(options.Entries) != len(expectedEntries) { t.Fatalf("unexpected number of entries:\nexpected: %d\ngot: %d", len(expectedEntries), len(options.Entries)) diff --git a/pkg/options/testdata/run_opt/file1.k b/pkg/options/testdata/run_opt/file1.k new file mode 100644 index 0000000..e03bc79 --- /dev/null +++ b/pkg/options/testdata/run_opt/file1.k @@ -0,0 +1 @@ +file1 = 1 \ No newline at end of file diff --git a/pkg/options/testdata/run_opt/file2.k b/pkg/options/testdata/run_opt/file2.k new file mode 100644 index 0000000..da1d487 --- /dev/null +++ b/pkg/options/testdata/run_opt/file2.k @@ -0,0 +1 @@ +file2 = 2 \ No newline at end of file diff --git a/pkg/options/testdata/run_opt/file3.k b/pkg/options/testdata/run_opt/file3.k new file mode 100644 index 0000000..2ab07ef --- /dev/null +++ b/pkg/options/testdata/run_opt/file3.k @@ -0,0 +1 @@ +file3 = 3 \ No newline at end of file