38 lines
636 B
Plaintext
38 lines
636 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
mypath=$( dirname $0 )
|
||
|
. "$mypath/common"
|
||
|
. "$mypath/../util/common-inv"
|
||
|
|
||
|
#expected values
|
||
|
eid=_foo
|
||
|
ename="Large Ugly Foobar"
|
||
|
ecount=5
|
||
|
|
||
|
# test item tag
|
||
|
item="$ecount:$eid"
|
||
|
|
||
|
|
||
|
# let's write a temporary item for testing
|
||
|
itemfile="$mypath/../items/_foo"
|
||
|
cat > $itemfile <<EOF
|
||
|
NAME $ename
|
||
|
EOF
|
||
|
|
||
|
|
||
|
assert-equal "$( inv-item-id "$item" )" "$eid" || {
|
||
|
fail "Unable to retrieve item id"
|
||
|
}
|
||
|
|
||
|
assert-eq $( inv-item-count "$item" ) $ecount || {
|
||
|
fail "Unable to retrieve item count"
|
||
|
}
|
||
|
|
||
|
assert-equal "$( inv-item-name "$item" )" "$ename" || {
|
||
|
fail "Unable to retrieve item name"
|
||
|
}
|
||
|
|
||
|
# we're done with our test item
|
||
|
rm $itemfile
|
||
|
|