打印消息升起时出错例外:type_error在plunit run_tests上
这些是在Chess.pl中定义的
:- dynamic drop/1.
:- dynamic start/1.
a_drop(X) :- piese(X), piese_pos(X, Y), \+ on(Y), assertz(drop(X)).
a_pickup(X) :- retract(drop(_-_-X)).
a_clear:- retract(drop(_)).
print_drops:- forall(drop(X), write(X)).
on(X) :- once(drop(_-_-X)).
off(X) :- \+ drop(_-_-X).
,我有此测试文件:
:- begin_tests(chess).
:- include(chess).
clear_board :- a_clear.
board_1_setup :- a_drop(b-r-(b-6)), a_drop(w-k-(d-5)), a_drop(w-b-(c-4)), a_drop(b-b-(b-3)).
test(hello, [
setup(board_1_setup),
cleanup(clear_board)
]) :- on(b-4).
:- end_tests(chess).
运行此命令时: swipp -g run_tests -t halt _chess.plt
这是输出。
% PL-Unit: chess
ERROR:
[[ EXCEPTION while printing message url('/home/eguneys/chess/pro/_chess.plt':10)
with arguments []:
raised: type_error(text,url('/home/eguneys/chess/pro/_chess.plt':10))
]]
:
test hello: failed
done
% 1 test failed
% 0 tests passed
ERROR: -g run_tests: false
我希望测试失败,但是有了友好的消息,这是什么错误垃圾。
请帮忙。
例如,当我测试时,测试会通过:...: - on(b-6)。
These are defined in chess.pl
:- dynamic drop/1.
:- dynamic start/1.
a_drop(X) :- piese(X), piese_pos(X, Y), \+ on(Y), assertz(drop(X)).
a_pickup(X) :- retract(drop(_-_-X)).
a_clear:- retract(drop(_)).
print_drops:- forall(drop(X), write(X)).
on(X) :- once(drop(_-_-X)).
off(X) :- \+ drop(_-_-X).
I have this test file:
:- begin_tests(chess).
:- include(chess).
clear_board :- a_clear.
board_1_setup :- a_drop(b-r-(b-6)), a_drop(w-k-(d-5)), a_drop(w-b-(c-4)), a_drop(b-b-(b-3)).
test(hello, [
setup(board_1_setup),
cleanup(clear_board)
]) :- on(b-4).
:- end_tests(chess).
When I run this command:swipl -g run_tests -t halt _chess.plt
This is the output.
% PL-Unit: chess
ERROR:
[[ EXCEPTION while printing message url('/home/eguneys/chess/pro/_chess.plt':10)
with arguments []:
raised: type_error(text,url('/home/eguneys/chess/pro/_chess.plt':10))
]]
:
test hello: failed
done
% 1 test failed
% 0 tests passed
ERROR: -g run_tests: false
I expected the test to fail, but with a friendlier message, what is this ERROR garbage.
Please help.
Tests passes normal when I test for example: ... :- on(b-6).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是在开发版本中修复的(
ppa:swi-prog/devel
)。您的测试文件中似乎有错别字或缺少的东西:
This seems to be fixed in the development version (
ppa:swi-prolog/devel
).There appear to be typos or things missing in your test files: