diff options
| author | Shulhan <ms@kilabit.info> | 2022-07-23 16:56:33 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-07-23 16:56:33 +0700 |
| commit | 7c11f5897a1d6bd525f67f51a3639ce24bc266ce (patch) | |
| tree | 1b2d22db66b38cd40e8254936175589d3dcf3c0e /lib/test/example_test.go | |
| parent | c80513b67f83f40f243c46c500d67a81f5b96df2 (diff) | |
| download | pakakeh.go-7c11f5897a1d6bd525f67f51a3639ce24bc266ce.tar.xz | |
lib/test: load test data files with suffix "_test.txt"
Previously, the LoadDataDir load all files from directory that have
".txt" extension.
This may cause unknown non-test data files loaded and may cause an error.
To distinguish it with other text files, inside the directory to be loaded
load only the file that has suffix "_test.txt".
Diffstat (limited to 'lib/test/example_test.go')
| -rw-r--r-- | lib/test/example_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/test/example_test.go b/lib/test/example_test.go index baa63195..bd415ddc 100644 --- a/lib/test/example_test.go +++ b/lib/test/example_test.go @@ -38,14 +38,14 @@ func ExampleLoadDataDir() { } // Output: - // test2.txt + // data2_test.txt // Flags=map[] // Desc= // Input // default=another test input. // Output // default=another test output. - // test1.txt + // data1_test.txt // Flags=map[key:value] // Desc=Description of test1. // Input @@ -62,7 +62,7 @@ func ExampleLoadData() { err error ) - // Content of test1.txt, + // Content of data1_test.txt, // // key: value // Description of test1. @@ -72,7 +72,7 @@ func ExampleLoadData() { // <<< // output. - data, err = LoadData("testdata/test1.txt") + data, err = LoadData("testdata/data1_test.txt") if err != nil { log.Fatal(err) } @@ -90,7 +90,7 @@ func ExampleLoadData() { } // Output: - // test1.txt + // data1_test.txt // Flags=map[key:value] // Desc=Description of test1. // Input |
