From b4fb95eade93ff93880d03111a78292449edff4d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 10 May 2016 23:08:33 -0700 Subject: [PATCH] doc: add `added:` information for assert PR-URL: https://github.com/nodejs/node/pull/6688 Ref: https://github.com/nodejs/node/issues/6578 Reviewed-By: Claudio Rodriguez Reviewed-By: James M Snell Reviewed-By: Roman Klauke Reviewed-By: Anna Henningsen --- doc/api/assert.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/doc/api/assert.md b/doc/api/assert.md index 35dbc3d2192209..e54e81d22e384e 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -13,6 +13,9 @@ additions or changes to any of the methods implemented and exposed by the module. ## assert(value[, message]) + An alias of [`assert.ok()`][] . @@ -30,6 +33,9 @@ assert(false, 'it\'s false'); ``` ## assert.deepEqual(actual, expected[, message]) + Tests for deep equality between the `actual` and `expected` parameters. Primitive values are compared with the equal comparison operator ( `==` ). @@ -88,6 +94,9 @@ property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error message is assigned. ## assert.deepStrictEqual(actual, expected[, message]) + Generally identical to `assert.deepEqual()` with two exceptions. First, primitive values are compared using the strict equality operator ( `===` ). @@ -109,6 +118,9 @@ property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error message is assigned. ## assert.doesNotThrow(block[, error][, message]) + Asserts that the function `block` does not throw an error. See [`assert.throws()`][] for more details. @@ -161,6 +173,9 @@ assert.doesNotThrow( ``` ## assert.equal(actual, expected[, message]) + Tests shallow, coercive equality between the `actual` and `expected` parameters using the equal comparison operator ( `==` ). @@ -184,6 +199,9 @@ property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error message is assigned. ## assert.fail(actual, expected, message, operator) + Throws an `AssertionError`. If `message` is falsy, the error message is set as the values of `actual` and `expected` separated by the provided `operator`. @@ -200,6 +218,9 @@ assert.fail(1, 2, 'whoops', '>'); ``` ## assert.ifError(value) + Throws `value` if `value` is truthy. This is useful when testing the `error` argument in callbacks. @@ -214,6 +235,9 @@ assert.ifError(new Error()); // Throws Error ``` ## assert.notDeepEqual(actual, expected[, message]) + Tests for any deep inequality. Opposite of [`assert.deepEqual()`][]. @@ -255,6 +279,9 @@ property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error message is assigned. ## assert.notDeepStrictEqual(actual, expected[, message]) + Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`][]. @@ -273,6 +300,9 @@ with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error message is assigned. ## assert.notEqual(actual, expected[, message]) + Tests shallow, coercive inequality with the not equal comparison operator ( `!=` ). @@ -295,6 +325,9 @@ property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error message is assigned. ## assert.notStrictEqual(actual, expected[, message]) + Tests strict inequality as determined by the strict not equal operator ( `!==` ). @@ -317,6 +350,9 @@ If the values are strictly equal, an `AssertionError` is thrown with a `message` parameter is undefined, a default error message is assigned. ## assert.ok(value[, message]) + Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`. @@ -339,6 +375,9 @@ assert.ok(false, 'it\'s false'); ``` ## assert.strictEqual(actual, expected[, message]) + Tests strict equality as determined by the strict equality operator ( `===` ). @@ -360,6 +399,9 @@ If the values are not strictly equal, an `AssertionError` is thrown with a `message` parameter is undefined, a default error message is assigned. ## assert.throws(block[, error][, message]) + Expects the function `block` to throw an error.