Closed
Description
Diffing is easy to attain in bats
If you add printDiff to every function.
It will only show the output if the test fails.
curious if @IsaacG has thoughts.
by changing
@test "a name given" {
[[ $BATS_RUN_SKIPPED == true ]] || skip
run two_fer Alice
[[ $status -eq 0 ]]
[[ $output == "One for Alice, one for me." ]]
}
printDiff(){
echo output;
echo "$output";
echo ;
echo expected;
echo "$expected;
}
@test "a name given" {
[[ $BATS_RUN_SKIPPED == true ]] || skip
run two_fer Alice
expected=$(cat <<-END
One for Alice, one for me.
END
)
printDiff
[[ $status -eq 0 ]]
[[ "$output" == "$expected" ]]
}
This actually just saved me on a project.
And I am sourcing the scripts like libs as is proposed in the pending pr
#373
Metadata
Metadata
Assignees
Labels
No labels