From d181977b8ba15109216a8007cd56f33b44ceb0a6 Mon Sep 17 00:00:00 2001 From: Jamie Davis Date: Thu, 7 Dec 2017 12:44:42 -0500 Subject: [PATCH] test: add test description to fs.readFile tests PR-URL: https://github.com/nodejs/node/pull/17610 Refs: https://github.com/nodejs/node/pull/17054#discussion_r155406755 Reviewed-By: Anna Henningsen Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel Reviewed-By: Jon Moss Reviewed-By: Ruben Bridgewater --- test/parallel/test-fs-readfile-empty.js | 3 +++ test/parallel/test-fs-readfile-error.js | 3 +++ test/parallel/test-fs-readfile-fd.js | 3 +++ test/parallel/test-fs-readfile-unlink.js | 3 +++ test/parallel/test-fs-readfile-zero-byte-liar.js | 3 +++ 5 files changed, 15 insertions(+) diff --git a/test/parallel/test-fs-readfile-empty.js b/test/parallel/test-fs-readfile-empty.js index 632bab5ec8b4fe..ac8d4755d3ff9f 100644 --- a/test/parallel/test-fs-readfile-empty.js +++ b/test/parallel/test-fs-readfile-empty.js @@ -1,5 +1,8 @@ 'use strict'; require('../common'); + +// Trivial test of fs.readFile on an empty file. + const assert = require('assert'); const fs = require('fs'); const fixtures = require('../common/fixtures'); diff --git a/test/parallel/test-fs-readfile-error.js b/test/parallel/test-fs-readfile-error.js index 7c8dd8feb6a770..752339d909ad45 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); + +// Test that fs.readFile fails correctly on a non-existent file. + // `fs.readFile('/')` does not fail on FreeBSD, because you can open and read // the directory there. if (common.isFreeBSD) diff --git a/test/parallel/test-fs-readfile-fd.js b/test/parallel/test-fs-readfile-fd.js index decd578d704bf6..c0e19a63d27ddf 100644 --- a/test/parallel/test-fs-readfile-fd.js +++ b/test/parallel/test-fs-readfile-fd.js @@ -1,5 +1,8 @@ 'use strict'; require('../common'); + +// Test fs.readFile using a file descriptor. + const fixtures = require('../common/fixtures'); const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-fs-readfile-unlink.js b/test/parallel/test-fs-readfile-unlink.js index 203ea681e5a079..c0e51b9866d4fe 100644 --- a/test/parallel/test-fs-readfile-unlink.js +++ b/test/parallel/test-fs-readfile-unlink.js @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); + +// Test that unlink succeeds immediately after readFile completes. + const assert = require('assert'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-fs-readfile-zero-byte-liar.js b/test/parallel/test-fs-readfile-zero-byte-liar.js index 82037a77e62122..182462d647a0dc 100644 --- a/test/parallel/test-fs-readfile-zero-byte-liar.js +++ b/test/parallel/test-fs-readfile-zero-byte-liar.js @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); + +// Test that readFile works even when stat returns size 0. + const assert = require('assert'); const fs = require('fs');