Skip to content

Commit 87462e6

Browse files
committed
[api] Rename assert.length to assert.lengthOf
This change is caused by nodejs/node-v0.x-archive@8c8d518 (sorry!). This commit made `assert` module behave like `assert.ok` function, thus (since JavaScript functions have length), `assert.length == assert.ok.length`. Because of that, assigning `assert.length` wouldn't change anything (function properties are freezed). This is a major API break.
1 parent fd44e08 commit 87462e6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/assert/macros.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ assert.isNotEmpty = function (actual, message) {
110110
}
111111
};
112112

113-
assert.length = function (actual, expected, message) {
113+
assert.lengthOf = function (actual, expected, message) {
114114
if (actual.length !== expected) {
115115
assert.fail(actual, expected, message || "expected {actual} to have {expected} element(s)", "length", assert.length);
116116
}

test/assert-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ vows.describe('vows/assert').addBatch({
1313
assert.match("hello world", /^[a-z]+ [a-z]+$/);
1414
},
1515
"`length`": function (assert) {
16-
assert.length("hello world", 11);
17-
assert.length([1, 2, 3], 3);
16+
assert.lengthOf("hello world", 11);
17+
assert.lengthOf([1, 2, 3], 3);
1818
},
1919
"`isDefined`": function (assert) {
2020
assert.isDefined(null);

test/vows-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ vows.describe("Vows").addBatch({
112112
return this.context.topics.slice(0);
113113
},
114114
"should pass the topics down": function (topics) {
115-
assert.length(topics, 2);
115+
assert.lengthOf(topics, 2);
116116
assert.equal(topics[0], 101);
117117
assert.equal(topics[1], 45);
118118
}

0 commit comments

Comments
 (0)