2015-01-13 19:30:24 +08:00
|
|
|
# NAME
|
2015-01-17 12:46:44 +08:00
|
|
|
# spec.eval - eval a test function
|
2015-01-13 19:30:24 +08:00
|
|
|
#
|
|
|
|
# SYNOPSIS
|
|
|
|
# spec.eval <function> [OPTIONS...]
|
|
|
|
#
|
2015-01-17 12:46:44 +08:00
|
|
|
# OPTIONS
|
|
|
|
# See spec.report
|
2015-01-13 19:30:24 +08:00
|
|
|
#
|
2015-01-17 12:46:44 +08:00
|
|
|
# AUTHORS
|
|
|
|
# Bruno Pinto <@pfbruno>
|
|
|
|
# Jorge Bucaran <@bucaran>
|
2015-01-13 19:30:24 +08:00
|
|
|
#/
|
2015-01-17 12:46:44 +08:00
|
|
|
import plugins/msg
|
2015-01-13 19:30:24 +08:00
|
|
|
|
2015-01-17 12:46:44 +08:00
|
|
|
function spec.eval
|
|
|
|
set -l result $status
|
|
|
|
set -l test $argv[1]
|
|
|
|
set -e argv[1]
|
2015-01-13 19:30:24 +08:00
|
|
|
|
2015-01-17 12:46:44 +08:00
|
|
|
if functions -q $test
|
2015-01-17 23:51:31 +08:00
|
|
|
# Erase previous test output
|
|
|
|
set -e _spec_current_test_ouput
|
|
|
|
|
2015-01-17 12:46:44 +08:00
|
|
|
# Run the test yielding control to the user defined spec.
|
2015-01-17 23:51:31 +08:00
|
|
|
eval $test
|
2015-01-17 12:46:44 +08:00
|
|
|
set result $status
|
2015-01-17 23:51:31 +08:00
|
|
|
|
2015-01-17 12:46:44 +08:00
|
|
|
# Display test results.
|
2015-01-17 23:51:31 +08:00
|
|
|
spec.view $test $result $argv -- $_spec_current_test_ouput
|
2015-01-13 19:30:24 +08:00
|
|
|
end
|
2015-01-17 23:51:31 +08:00
|
|
|
|
2015-01-14 03:05:43 +08:00
|
|
|
return $result
|
2015-01-13 19:30:24 +08:00
|
|
|
end
|