mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
test: test surrogate pair filenames on windows
PR-URL: https://github.com/nodejs/node/pull/51800 Fixes: https://github.com/nodejs/node/issues/51789 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
1 parent
8a94177eb9
commit
8e7da60468
1 file changed
+31
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const assert = require('node:assert');
|
||||
const { describe, it } = require('node:test');
|
||||
const tmpdir = require('../common/tmpdir');
|
||||
|
||||
tmpdir.refresh();
|
||||
|
||||
describe('File operations with filenames containing surrogate pairs', () => {
|
||||
it('should write, read, and delete a file with surrogate pairs in the filename', () => {
|
||||
// Create a temporary directory
|
||||
const tempdir = fs.mkdtempSync(tmpdir.resolve('emoji-fruit-🍇 🍈 🍉 🍊 🍋'));
|
||||
assert.strictEqual(fs.existsSync(tempdir), true);
|
||||
|
||||
const filename = '🚀🔥🛸.txt';
|
||||
const content = 'Test content';
|
||||
|
||||
// Write content to a file
|
||||
fs.writeFileSync(path.join(tempdir, filename), content);
|
||||
|
||||
// Read content from the file
|
||||
const readContent = fs.readFileSync(path.join(tempdir, filename), 'utf8');
|
||||
|
||||
// Check if the content matches
|
||||
assert.strictEqual(readContent, content);
|
||||
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user