From a6f95d13019d933f23ad9ad47a66cd34a715c9e2 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 bbc2e9c81d6251..21f99fc6be24ba 100644 --- a/test/parallel/test-fs-readfile-empty.js +++ b/test/parallel/test-fs-readfile-empty.js @@ -21,6 +21,9 @@ '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 e7c52f19a83d1c..616760b06695a1 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -21,6 +21,9 @@ '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 7881666cadb31a..7458af7b2e53af 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 abcbed7ad5df53..9ec2e849bee19f 100644 --- a/test/parallel/test-fs-readfile-unlink.js +++ b/test/parallel/test-fs-readfile-unlink.js @@ -21,6 +21,9 @@ '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 625438e7c68c88..ec0b9cf6922c8c 100644 --- a/test/parallel/test-fs-readfile-zero-byte-liar.js +++ b/test/parallel/test-fs-readfile-zero-byte-liar.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); + +// Test that readFile works even when stat returns size 0. + const assert = require('assert'); const fs = require('fs');