You've already forked pathsd
Initial release
This commit is contained in:
1
tests/fixtures/paths.d/01-bilbo
vendored
Normal file
1
tests/fixtures/paths.d/01-bilbo
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/Users/bilbo/opt/bin
|
||||
2
tests/fixtures/paths.d/02-homebrew
vendored
Normal file
2
tests/fixtures/paths.d/02-homebrew
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/opt/homebrew/bin
|
||||
/opt/homebrew/sbin
|
||||
30
tests/pathsd/test_main.nim
Normal file
30
tests/pathsd/test_main.nim
Normal file
@@ -0,0 +1,30 @@
|
||||
import std/[logging, paths]
|
||||
import unittest
|
||||
|
||||
import ../../src/pathsd
|
||||
|
||||
suite "Test main() proc":
|
||||
setup:
|
||||
const fixturesPath = Path(currentSourcePath) / Path("..") / Path("..") / Path("fixtures")
|
||||
const pathsdFixturePath = fixturesPath / Path("paths.d")
|
||||
const expectedOutput = @["/Users/bilbo/opt/bin", "/opt/homebrew/bin", "/opt/homebrew/sbin"]
|
||||
|
||||
pathsd.logger.levelThreshold = lvlNone
|
||||
|
||||
test "Test happy path":
|
||||
# When
|
||||
var mainResult = pathsd.main(@[pathsdFixturePath.string])
|
||||
|
||||
# Then
|
||||
check mainResult.output == expectedOutput
|
||||
check mainResult.errorCode == QuitSuccess
|
||||
|
||||
test "Test skipping search paths that don't exist":
|
||||
# When
|
||||
var mainResult = pathsd.main(@[
|
||||
pathsdFixturePath.string,
|
||||
(fixturesPath / Path("idontexist")).string,
|
||||
])
|
||||
|
||||
# Then
|
||||
check mainResult.output == expectedOutput
|
||||
1
tests/tester.nim
Normal file
1
tests/tester.nim
Normal file
@@ -0,0 +1 @@
|
||||
import pathsd/test_main
|
||||
Reference in New Issue
Block a user