mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 18:48:33 -04:00
test: Fixed scan_test.
This commit is contained in:
2
TODOS.md
2
TODOS.md
@@ -24,8 +24,6 @@
|
|||||||
|
|
||||||
16. Add tests for untested commands.
|
16. Add tests for untested commands.
|
||||||
|
|
||||||
17. 2 scan tests silently skip when fd isn't installed, tests pass without actually testing anything. These should use #assert to be sure that fd is in path.
|
|
||||||
|
|
||||||
18. add --format -f flag to commands that draw tables.
|
18. add --format -f flag to commands that draw tables.
|
||||||
|
|
||||||
19. Replace `testing.expect` calls with `testing.expect_value` calls where appropriate.
|
19. Replace `testing.expect` calls with `testing.expect_value` calls where appropriate.
|
||||||
|
|||||||
@@ -19,20 +19,23 @@ test_scan_path_finds_gitignored_env_files :: proc(t: ^testing.T) {
|
|||||||
stderr = os.stderr,
|
stderr = os.stderr,
|
||||||
}
|
}
|
||||||
p, err := os.process_start(git_init)
|
p, err := os.process_start(git_init)
|
||||||
if err != nil {
|
testing.expectf(t, err == nil, "Failed to run git: %v", err)
|
||||||
return
|
if err != nil do return
|
||||||
}
|
state, wait_err := os.process_wait(p)
|
||||||
_, wait_err := os.process_wait(p)
|
testing.expectf(t, wait_err == nil, "Failed to wait: %v", wait_err)
|
||||||
if wait_err != nil {
|
if wait_err != nil do return
|
||||||
return
|
testing.expect(t, state.success, "command should succeed")
|
||||||
}
|
|
||||||
|
|
||||||
gitignore_path := fmt.tprintf("%s/.gitignore", base)
|
gitignore_path := fmt.tprintf("%s/.gitignore", base)
|
||||||
_ = os.write_entire_file(gitignore_path, ".env*\n")
|
err = os.write_entire_file(gitignore_path, ".env*\n")
|
||||||
|
testing.expectf(t, err == nil, "Failed: %v", err)
|
||||||
|
|
||||||
_ = os.write_entire_file(fmt.tprintf("%s/.env", base), "SECRET=1")
|
err = os.write_entire_file(fmt.tprintf("%s/.env", base), "SECRET=1")
|
||||||
_ = os.write_entire_file(fmt.tprintf("%s/.env.testing", base), "TEST=1")
|
testing.expectf(t, err == nil, "Failed: %v", err)
|
||||||
_ = os.write_entire_file(fmt.tprintf("%s/config.yaml", base), "key: value")
|
err = os.write_entire_file(fmt.tprintf("%s/.env.testing", base), "TEST=1")
|
||||||
|
testing.expectf(t, err == nil, "Failed: %v", err)
|
||||||
|
err = os.write_entire_file(fmt.tprintf("%s/config.yaml", base), "key: value")
|
||||||
|
testing.expectf(t, err == nil, "Failed: %v", err)
|
||||||
|
|
||||||
cfg := Config {
|
cfg := Config {
|
||||||
scan_config = ScanConfig{matcher = "\\.env"},
|
scan_config = ScanConfig{matcher = "\\.env"},
|
||||||
|
|||||||
Reference in New Issue
Block a user