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