8000 test: s/assert.equal/assert.strictEqual/ · nodejs/node@51f4c8b · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 51f4c8b

Browse files
gibfahnItalo A. Casas
authored andcommitted
test: s/assert.equal/assert.strictEqual/
Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: #10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
1 parent 31f8f6f commit 51f4c8b

File tree

332 files changed

+1710
-1671
lines changed
  • parallel
  • pummel
  • sequential
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    332 files changed

    +1710
    -1671
    lines changed

    test/disabled/test-fs-largefile.js

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -9,22 +9,22 @@ const path = require('path'),
    99
    message = 'Large File';
    1010

    1111
    fs.truncateSync(fd, offset);
    12-
    assert.equal(fs.statSync(filepath).size, offset);
    12+
    assert.strictEqual(fs.statSync(filepath).size, offset);
    1313
    var writeBuf = Buffer.from(message);
    1414
    fs.writeSync(fd, writeBuf, 0, writeBuf.length, offset);
    1515
    var readBuf = Buffer.allocUnsafe(writeBuf.length);
    1616
    fs.readSync(fd, readBuf, 0, readBuf.length, offset);
    17-
    assert.equal(readBuf.toString(), message);
    17+
    assert.strictEqual(readBuf.toString(), message);
    1818
    fs.readSync(fd, readBuf, 0, 1, 0);
    19-
    assert.equal(readBuf[0], 0);
    19+
    assert.strictEqual(readBuf[0], 0);
    2020

    2121
    var exceptionRaised = false;
    2222
    try {
    2323
    fs.writeSync(fd, writeBuf, 0, writeBuf.length, 42.000001);
    2424
    } catch (err) {
    2525
    console.log(err);
    2626
    exceptionRaised = true;
    27-
    assert.equal(err.message, 'Not an integer');
    27+
    assert.strictEqual(err.message, 'Not an integer');
    2828
    }
    2929
    assert.ok(exceptionRaised);
    3030
    fs.close(fd);

    test/disabled/test-http-abort-stream-end.js

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -36,6 +36,6 @@ s.listen(common.PORT, function() {
    3636

    3737
    process.on('exit', function() {
    3838
    assert(aborted);
    39-
    assert.equal(size, maxSize);
    39+
    assert.strictEqual(size, maxSize);
    4040
    console.log('ok');
    4141
    });

    test/disabled/test-readline.js

    Lines changed: 7 additions & 7 deletions
    Original file line numberDiff line numberDiff line change
    @@ -49,12 +49,12 @@ var rl = readlineFakeStream();
    4949
    var written_bytes_length, refreshed;
    5050

    5151
    rl.write('foo');
    52-
    assert.equal(3, rl.cursor);
    52+
    assert.strictEqual(3, rl.cursor);
    5353
    [key.xterm, key.rxvt, key.gnome, key.putty].forEach(function(key) {
    5454
    rl.write.apply(rl, key.home);
    55-
    assert.equal(0, rl.cursor);
    55+
    assert.strictEqual(0, rl.cursor);
    5656
    rl.write.apply(rl, key.end);
    57-
    assert.equal(3, rl.cursor);
    57+
    assert.strictEqual(3, rl.cursor);
    5858
    });
    5959

    6060
    rl = readlineFakeStream();
    @@ -76,9 +76,9 @@ rl.write.apply(rl, key.xterm.home);
    7676
    ].forEach(function(action) {
    7777
    written_bytes_length = rl.written_bytes.length;
    7878
    rl.write.apply(rl, action.key);
    79-
    assert.equal(action.cursor, rl.cursor);
    79+
    assert.strictEqual(action.cursor, rl.cursor);
    8080
    refreshed = written_bytes_length !== rl.written_bytes.length;
    81-
    assert.equal(true, refreshed);
    81+
    assert.strictEqual(true, refreshed);
    8282
    });
    8383

    8484
    rl = readlineFakeStream();
    @@ -93,7 +93,7 @@ rl.write.apply(rl, key.xterm.home);
    9393
    ''
    9494
    ].forEach(function(expectedLine) {
    9595
    rl.write.apply(rl, key.xterm.metad);
    96-
    assert.equal(0, rl.cursor);
    97-
    assert.equal(expectedLine, rl.line);
    96+
    assert.strictEqual(0, rl.cursor);
    97+
    assert.strictEqual(expectedLine, rl.line);
    9898
    });
    9999
    rl.close();

    test/disabled/test-sendfd.js

    Lines changed: 5 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -63,7 +63,7 @@ var logChild = function(d) {
    6363
    // validate any data sent back by the child. We send the write end of the
    6464
    // pipe to the child and close it off in our process.
    6565
    var pipeFDs = netBinding.pipe();
    66-
    assert.equal(pipeFDs.length, 2);
    66+
    assert.strictEqual(pipeFDs.length, 2);
    6767

    6868
    var seenOrdinals = [];
    6969

    @@ -72,8 +72,8 @@ pipeReadStream.on('data', function(data) {
    7272
    data.toString('utf8').trim().split('\n').forEach(function(d) {
    7373
    var rd = JSON.parse(d);
    7474

    75-
    assert.equal(rd.pid, cpp);
    76-
    assert.equal(seenOrdinals.indexOf(rd.ord), -1);
    75+
    assert.strictEqual(rd.pid, cpp);
    76+
    assert.strictEqual(seenOrdinals.indexOf(rd.ord), -1);
    7777

    7878
    seenOrdinals.unshift(rd.ord);
    7979
    });
    @@ -119,8 +119,8 @@ cp.on('exit', function(code, signal) {
    119119
    srv.close();
    120120
    // fs.unlinkSync(SOCK_PATH);
    121121

    122-
    assert.equal(code, 0);
    123-
    assert.equal(seenOrdinals.length, 2);
    122+
    assert.strictEqual(code, 0);
    123+
    assert.strictEqual(seenOrdinals.length, 2);
    124124
    });
    125125

    126126
    // vim:ts=2 sw=2 et

    test/disabled/test-setuidgid.js

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -16,7 +16,7 @@ assert.notStrictEqual(newuid, olduid, 'uids expected to be different');
    1616
    try {
    1717
    process.setuid('nobody1234');
    1818
    } catch (e) {
    19-
    assert.equal(e.message,
    19+
    assert.strictEqual(e.message,
    2020
    'failed to resolve group',
    2121
    'unexpected error message'
    2222
    );

    test/fixtures/GH-892-request.js

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -16,7 +16,7 @@ var options = {
    1616
    };
    1717

    1818
    var req = https.request(options, function(res) {
    19-
    assert.equal(200, res.statusCode);
    19+
    assert.strictEqual(200, res.statusCode);
    2020
    gotResponse = true;
    2121
    console.error('DONE');
    2222
    res.resume();

    test/fixtures/b/c.js

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -4,7 +4,7 @@ const assert = require('assert');
    44

    55
    const package = require('./package');
    66

    7-
    assert.equal('world', package.hello);
    7+
    assert.strictEqual('world', package.hello);
    88

    99
    console.error('load fixtures/b/c.js');
    1010

    test/fixtures/node_modules/baz/index.js

    Lines changed: 2 additions & 2 deletions
    Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

    test/fixtures/node_modules/foo.js

    Lines changed: 1 addition & 1 deletion
    Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

    test/internet/test-dns-txt-sigsegv.js

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -4,6 +4,6 @@ const assert = require('assert');
    44
    const dns = require('dns');
    55

    66
    dns.resolveTxt('www.microsoft.com', function(err, records) {
    7-
    assert.equal(err, null);
    8-
    assert.equal(records.length, 0);
    7+
    assert.strictEqual(err, null);
    8+
    assert.strictEqual(records.length, 0);
    99
    });

    0 commit comments

    Comments
     (0)
    0