caolan / caolan/nodeunit

deepEqual not Usable on Buffers

未关闭
#141 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
1.9k
派生
359
PR 合并指标
30 天内没有已合并 PR

描述

Using nodeunit 0.6 on node 0.4.12 (and others), the following test:

```
exports.test = function (test) {
var a = new Buffer([0]), b = new Buffer([0]);
test.deepEqual(a, b);
test.done();
};
```

Fails with:

```
test
✖ test

AssertionError: deepEqual
at Object.deepEqual (/home/smith/nu/node_modules/nodeunit/lib/types.js:83:39)
at Object. (/home/smith/nu/test.js:3:10)
at Object. (/home/smith/nu/node_modules/nodeunit/lib/core.js:233:16)
at /home/smith/nu/node_modules/nodeunit/lib/core.js:233:16
at Object.runTest (/home/smith/nu/node_modules/nodeunit/lib/core.js:69:9)
at /home/smith/nu/node_modules/nodeunit/lib/core.js:115:25
at /home/smith/nu/node_modules/nodeunit/deps/async.js:508:13
at /home/smith/nu/node_modules/nodeunit/deps/async.js:118:13
at /home/smith/nu/node_modules/nodeunit/deps/async.js:134:9
at /home/smith/nu/node_modules/nodeunit/deps/async.js:507:9
```

This test passes with nodeunit 0.4. It would be nice if deepEqual, or some method, worked to compare Buffers.

This is used on https://github.com/cramerdev/gearman-node/blob/master/test/test-packet.js, among other places.

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 lib/types.js:83 开始,失败的 deepEqual 断言会在那里报告,并使用报告中的 Buffer 示例重现该问题。为两个相等的 Buffer 添加回归测试,并验证 deepEqual 会接受它们,同时仍能正确报告不相等的 Buffer。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, node.js
领域
testing-qa
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。