mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-07 14:11:52 +00:00
Adds two more assertions to testlib
This commit adds the following two assertions: - assert_files_equal - assert_files_not_equal These can be used in tests for validating file equality consistently.
This commit is contained in:
committed by
Matthew Johnson
parent
207028be84
commit
db746d6dd2
@@ -1510,3 +1510,30 @@ assert_not_equal() {
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
assert_files_equal() {
|
||||
|
||||
local val1=$1
|
||||
local val2=$2
|
||||
validate_item "$val1"
|
||||
validate_item "$val2"
|
||||
|
||||
diff -q "$val1" "$val2"
|
||||
|
||||
}
|
||||
|
||||
assert_files_not_equal() {
|
||||
|
||||
local val1=$1
|
||||
local val2=$2
|
||||
validate_item "$val1"
|
||||
validate_item "$val2"
|
||||
|
||||
if diff -q "$val1" "$val2" > /dev/null; then
|
||||
echo "Files $val1 and $val2 are equal"
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user