testing.load() 函数
testing.load()
从表流加载测试数据。
函数类型签名
(<-tables: A) => A
有关更多信息,请参阅 函数类型签名。
参数
tables
输入数据。默认为管道转发数据 (<-
)。
示例
在测试用例中加载原始表流
以下测试使用 array.from()
创建两个表流,以便在测试中进行比较。
import "testing"
import "array"
got =
array.from(
rows: [
{_time: 2021-01-01T00:00:00Z, _measurement: "m", _field: "t", _value: 1.2},
{_time: 2021-01-01T01:00:00Z, _measurement: "m", _field: "t", _value: 0.8},
{_time: 2021-01-01T02:00:00Z, _measurement: "m", _field: "t", _value: 3.2},
],
)
want =
array.from(
rows: [
{_time: 2021-01-01T00:00:00Z, _measurement: "m", _field: "t", _value: 1.2},
{_time: 2021-01-01T01:00:00Z, _measurement: "m", _field: "t", _value: 0.8},
{_time: 2021-01-01T02:00:00Z, _measurement: "m", _field: "t", _value: 3.1},
],
)
testing.load(tables: got)
|> testing.diff(want: want)
此页面是否对您有帮助?
感谢您的反馈!