-
-
Notifications
You must be signed in to change notification settings - Fork 96
Add diffing support to bash tests #531
Copy link
Copy link
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels