Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor test-fs-buffer #11232

Closed
wants to merge 2 commits into from
Closed

test: refactor test-fs-buffer #11232

wants to merge 2 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Feb 8, 2017

  • Remove unneeded temp dir cleanup
  • Add check for error in .close() callback
  • Improve error reporting

On that last bullet point, the previous version of the test reported
errors like this:

AssertionError: [ '.empty-repl-history-file',
  '.node_repl_history',
  'GH-1899-output.js',
  'GH-892-request.js',
  'a.js',
  'a1.js',
  'agen deepStrictEqual [ '.empty-repl-history-file',
  '.node_repl_history',
  'GH-1899-output.js',
  'GH-892-request.js',
  'a.js',
  'a1.js',
  'agen

Now, they look like this:

AssertionError: 2a is hex value for * and not catch-stdout-error.js
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test fs

@Trott Trott added fs Issues and PRs related to the fs subsystem / file system. test Issues and PRs related to the tests. labels Feb 8, 2017
assert.strictEqual(
fromHexList,
val,
`${hexList[idx]} is hex value for ${fromHexList} and not ${val}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the more common wording would be something like

const valHex = Buffer.from(val).toString('hex');
const message = `expected ${valHex} as hex value for ${val}, ` +
                `got ${hexList[idx]} (hex value for ${fromHexList})`

If I am reading this correctly?

Copy link
Member Author

@Trott Trott Feb 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your wording is better. Will update...

Copy link
Member Author

@Trott Trott Feb 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?:

`expected ${val}, got ${fromHexList} by hex decoding ${hexList[idx]}`

The thing I'm trying to convey is this: val is the input. We put it in a file hex encoded. We read the file back in and got the hex-encoded value hexList[idx]. When we hex decode that value, we got fromHexList instead of val.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah your proposal works too, and it is more succinct :)

* Remove unneeded temp dir cleanup
* Add check for error in `.close()` callback
* Improve error reporting

On that last bullet point, the previous version of the test reported
errors like this:

```
AssertionError: [ '.empty-repl-history-file',
  '.node_repl_history',
  'nodejsGH-1899-output.js',
  'nodejsGH-892-request.js',
  'a.js',
  'a1.js',
  'agen deepStrictEqual [ '.empty-repl-history-file',
  '.node_repl_history',
  'nodejsGH-1899-output.js',
  'nodejsGH-892-request.js',
  'a.js',
  'a1.js',
  'agen
```

Now, they look like this:

```
AssertionError: 2a is hex value for * and not catch-stdout-error.js
```
@Trott
Copy link
Member Author

Trott commented Feb 9, 2017

Trott added a commit to Trott/io.js that referenced this pull request Feb 10, 2017
* Remove unneeded temp dir cleanup
* Add check for error in `.close()` callback
* Improve error reporting

On that last bullet point, the previous version of the test reported
errors like this:

```
AssertionError: [ '.empty-repl-history-file',
  '.node_repl_history',
  'nodejsGH-1899-output.js',
  'nodejsGH-892-request.js',
  'a.js',
  'a1.js',
  'agen deepStrictEqual [ '.empty-repl-history-file',
  '.node_repl_history',
  'nodejsGH-1899-output.js',
  'nodejsGH-892-request.js',
  'a.js',
  'a1.js',
  'agen
```

Now, they look like this:

```
AssertionError: expected *, got ! by hex decoding 2a
```

PR-URL: nodejs#11232
Reviewed-By: James M Snell <[email protected]>
@Trott
Copy link
Member Author

Trott commented Feb 10, 2017

Landed in 05be623

@Trott Trott closed this Feb 10, 2017
italoacasas pushed a commit that referenced this pull request Feb 13, 2017
* Remove unneeded temp dir cleanup
* Add check for error in `.close()` callback
* Improve error reporting

On that last bullet point, the previous version of the test reported
errors like this:

```
AssertionError: [ '.empty-repl-history-file',
  '.node_repl_history',
  'GH-1899-output.js',
  'GH-892-request.js',
  'a.js',
  'a1.js',
  'agen deepStrictEqual [ '.empty-repl-history-file',
  '.node_repl_history',
  'GH-1899-output.js',
  'GH-892-request.js',
  'a.js',
  'a1.js',
  'agen
```

Now, they look like this:

```
AssertionError: expected *, got ! by hex decoding 2a
```

PR-URL: #11232
Reviewed-By: James M Snell <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Feb 14, 2017
* Remove unneeded temp dir cleanup
* Add check for error in `.close()` callback
* Improve error reporting

On that last bullet point, the previous version of the test reported
errors like this:

```
AssertionError: [ '.empty-repl-history-file',
  '.node_repl_history',
  'nodejsGH-1899-output.js',
  'nodejsGH-892-request.js',
  'a.js',
  'a1.js',
  'agen deepStrictEqual [ '.empty-repl-history-file',
  '.node_repl_history',
  'nodejsGH-1899-output.js',
  'nodejsGH-892-request.js',
  'a.js',
  'a1.js',
  'agen
```

Now, they look like this:

```
AssertionError: expected *, got ! by hex decoding 2a
```

PR-URL: nodejs#11232
Reviewed-By: James M Snell <[email protected]>
krydos pushed a commit to krydos/node that referenced this pull request Feb 25, 2017
* Remove unneeded temp dir cleanup
* Add check for error in `.close()` callback
* Improve error reporting

On that last bullet point, the previous version of the test reported
errors like this:

```
AssertionError: [ '.empty-repl-history-file',
  '.node_repl_history',
  'nodejsGH-1899-output.js',
  'nodejsGH-892-request.js',
  'a.js',
  'a1.js',
  'agen deepStrictEqual [ '.empty-repl-history-file',
  '.node_repl_history',
  'nodejsGH-1899-output.js',
  'nodejsGH-892-request.js',
  'a.js',
  'a1.js',
  'agen
```

Now, they look like this:

```
AssertionError: expected *, got ! by hex decoding 2a
```

PR-URL: nodejs#11232
Reviewed-By: James M Snell <[email protected]>
@jasnell
Copy link
Member

jasnell commented Mar 7, 2017

would need backport PRs to land in v4 or v6

@Trott Trott deleted the refac-fs-buf branch January 13, 2022 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants