GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: run more assert tests · nodejs/node@2c27df2

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-assert-deep.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-assert-deep.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-assert-deep.js
+9-16Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ class MyDate extends Date {
109109

110110
const date2 = new MyDate('2016');
111111

112-
// deepEqual returns true as long as the time are the same,
113-
// but deepStrictEqual checks own properties
114-
assert.notDeepEqual(date, date2);
115-
assert.notDeepEqual(date2, date);
112+
assertNotDeepOrStrict(date, date2);
116113
assert.throws(
117114
() => assert.deepStrictEqual(date, date2),
118115
{
@@ -142,9 +139,7 @@ class MyRegExp extends RegExp {
142139
const re1 = new RegExp('test');
143140
const re2 = new MyRegExp('test');
144141

145-
// deepEqual returns true as long as the regexp-specific properties
146-
// are the same, but deepStrictEqual checks all properties
147-
assert.notDeepEqual(re1, re2);
142+
assertNotDeepOrStrict(re1, re2);
148143
assert.throws(
149144
() => assert.deepStrictEqual(re1, re2),
150145
{
@@ -684,7 +679,7 @@ assert.throws(
684679
}
685680
);
686681

687-
assert.deepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14));
682+
assertDeepAndStrictEqual(new Date(2000, 3, 14), new Date(2000, 3, 14));
688683

689684
assert.throws(() => { assert.deepEqual(new Date(), new Date(2000, 3, 14)); },
690685
AssertionError,
@@ -702,7 +697,7 @@ assert.throws(
702697
'notDeepEqual("a".repeat(1024), "a".repeat(1024))'
703698
);
704699

705-
assert.notDeepEqual(new Date(), new Date(2000, 3, 14));
700+
assertNotDeepOrStrict(new Date(), new Date(2000, 3, 14));
706701

707702
assertDeepAndStrictEqual(/a/, /a/);
708703
assertDeepAndStrictEqual(/a/g, /a/g);
@@ -743,7 +738,7 @@ a2.b = true;
743738
a2.a = 'test';
744739
assert.throws(() => assert.deepEqual(Object.keys(a1), Object.keys(a2)),
745740
AssertionError);
746-
assert.deepEqual(a1, a2);
741+
assertDeepAndStrictEqual(a1, a2);
747742

748743
// Having an identical prototype property.
749744
const nbRoot = {
@@ -899,14 +894,12 @@ assert.throws(
899894

900895
/* eslint-enable */
901896

902-
assert.deepStrictEqual({ a: 4, b: '1' }, { b: '1', a: 4 });
897+
assertDeepAndStrictEqual({ a: 4, b: '1' }, { b: '1', a: 4 });
903898

904899
assert.throws(
905900
() => assert.deepStrictEqual([0, 1, 2, 'a', 'b'], [0, 1, 2, 'b', 'a']),
906901
AssertionError);
907902

908-
assert.deepStrictEqual(a1, a2);
909-
910903
// Prototype check.
911904
function Constructor1(first, last) {
912905
this.first = first;
@@ -926,7 +919,7 @@ assert.throws(() => assert.deepStrictEqual(obj1, obj2), AssertionError);
926919
Constructor2.prototype = Constructor1.prototype;
927920
obj2 = new Constructor2('Ryan', 'Dahl');
928921

929-
assert.deepStrictEqual(obj1, obj2);
922+
assertDeepAndStrictEqual(obj1, obj2);
930923

931924
// Check extra properties on errors.
932925
{
@@ -1047,7 +1040,7 @@ assert.throws(
10471040
Object.defineProperty(a, 'getTime', {
10481041
value: () => 5
10491042
});
1050-
assert.deepStrictEqual(a, b);
1043+
assertDeepAndStrictEqual(a, b);
10511044
}
10521045

10531046
// Verify that an array and the equivalent fake array object
@@ -1079,7 +1072,7 @@ assert.throws(
10791072
Object.defineProperty(a, 'length', {
10801073
value: 2
10811074
});
1082-
assert.notDeepStrictEqual(a, [1, 1]);
1075+
assertNotDeepOrStrict(a, [1, 1]);
10831076
}
10841077

10851078
// Verify that changed tags will still check for the error message.

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.