testing - 在 Scheme 中如何检查一个值是否为 "error"类型?

标签 testing exception scheme r6rs

关于 standard libraries for Scheme r6rs 的手册建议如果我导入库 (rnrs exceptions (6)) 我应该能够调用 (error?val) 来检查给定值是否为 &error 类型。我想为单元测试做这个。我已将该库添加到我的导入 header 中并且代码已编译,所以我知道导入工作正常。但是 DrRacket 仍然将 error? 识别为未定义。有谁知道这里发生了什么?

我的代码:

#!r6rs
(import (rnrs base) (rnrs exceptions (6)))
(error? "hello world")

最佳答案

您需要条件库:

#!r6rs
(import (rnrs) (rnrs conditions))
(display (error? "hello world"))

产量

=> #f

关于testing - 在 Scheme 中如何检查一个值是否为 "error"类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21652417/

相关文章:

来自 django 文档的 Python selenium Web 驱动程序示例错误 : 'f.QueryInterface is not a function'

java - Android 测试 null 和条件

php - 如何让 behat 等待元素显示在屏幕上后再填充它?

scheme - 如何在Scheme中的列表中应用匿名函数?

scheme - 在 lisp 中编写一个利用两个命名空间的测试函数

algorithm - 函数式编程习惯用法,用于计算 racket/haskell 中不发生突变的最多 4 个数字

reactjs - React 测试,我是否在浪费时间尝试不使用 Redux?

exception - HIVE加入问题

java - 为 ListView 项目设置背景?

c++ - 关于异常的编译错误