You've already forked pathsd
Dedupe output parts
This commit is contained in:
@@ -7,13 +7,17 @@ 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"]
|
||||
const envParts = @["/usr/local/bin", "/usr/bin"]
|
||||
const expectedOutput = @[
|
||||
"/Users/bilbo/opt/bin", "/opt/homebrew/bin", "/opt/homebrew/sbin",
|
||||
"/usr/local/bin", "/usr/bin",
|
||||
]
|
||||
|
||||
pathsd.logger.levelThreshold = lvlNone
|
||||
|
||||
test "Test happy path":
|
||||
# When
|
||||
var mainResult = pathsd.main(@[pathsdFixturePath.string])
|
||||
var mainResult = pathsd.main(@[pathsdFixturePath.string], envParts, false)
|
||||
|
||||
# Then
|
||||
check mainResult.output == expectedOutput
|
||||
@@ -21,10 +25,28 @@ suite "Test main() proc":
|
||||
|
||||
test "Test skipping search paths that don't exist":
|
||||
# When
|
||||
var mainResult = pathsd.main(@[
|
||||
pathsdFixturePath.string,
|
||||
(fixturesPath / Path("idontexist")).string,
|
||||
])
|
||||
var mainResult = pathsd.main(
|
||||
@[
|
||||
pathsdFixturePath.string,
|
||||
(fixturesPath / Path("idontexist")).string,
|
||||
],
|
||||
envParts,
|
||||
false,
|
||||
)
|
||||
|
||||
# Then
|
||||
check mainResult.output == expectedOutput
|
||||
|
||||
test "Test dedupe":
|
||||
# Given
|
||||
const localEnvParts = @[
|
||||
"/usr/local/bin", "/usr/bin", "/Users/bilbo/opt/bin",
|
||||
]
|
||||
|
||||
# When
|
||||
var mainResult = pathsd.main(
|
||||
@[pathsdFixturePath.string], localEnvParts, true,
|
||||
)
|
||||
|
||||
# Then
|
||||
check mainResult.output == expectedOutput
|
||||
|
||||
Reference in New Issue
Block a user