Initial release

This commit is contained in:
2023-12-05 20:13:26 +00:00
parent 804082112a
commit d1eb53b952
19 changed files with 385 additions and 1 deletions

1
tests/fixtures/paths.d/01-bilbo vendored Normal file
View File

@@ -0,0 +1 @@
/Users/bilbo/opt/bin

2
tests/fixtures/paths.d/02-homebrew vendored Normal file
View File

@@ -0,0 +1,2 @@
/opt/homebrew/bin
/opt/homebrew/sbin

View 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
View File

@@ -0,0 +1 @@
import pathsd/test_main