mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
642 B
24 lines
642 B
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
common.refreshTmpDir();
|
|
|
|
{
|
|
const file = path.join(common.tmpDir, 'write-end-test0.txt');
|
|
const stream = fs.createWriteStream(file);
|
|
stream.end();
|
|
stream.on('close', common.mustCall(function() { }));
|
|
}
|
|
|
|
{
|
|
const file = path.join(common.tmpDir, 'write-end-test1.txt');
|
|
const stream = fs.createWriteStream(file);
|
|
stream.end('a\n', 'utf8');
|
|
stream.on('close', common.mustCall(function() {
|
|
const content = fs.readFileSync(file, 'utf8');
|
|
assert.strictEqual(content, 'a\n');
|
|
}));
|
|
}
|
|
|