Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1743d2b

Browse filesBrowse files
mertcanaltinrichardlau
authored andcommitted
test: test surrogate pair filenames on windows
PR-URL: #51800 Fixes: #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>
1 parent 8bfb8f5 commit 1743d2b
Copy full SHA for 1743d2b

File tree

Expand file treeCollapse file tree

1 file changed

+31
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+31
-0
lines changed
Open diff view settings
Collapse file
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
3+
require('../common');
4+
const fs = require('node:fs');
5+
const path = require('node:path');
6+
const assert = require('node:assert');
7+
const { describe, it } = require('node:test');
8+
const tmpdir = require('../common/tmpdir');
9+
10+
tmpdir.refresh();
11+
12+
describe('File operations with filenames containing surrogate pairs', () => {
13+
it('should write, read, and delete a file with surrogate pairs in the filename', () => {
14+
// Create a temporary directory
15+
const tempdir = fs.mkdtempSync(tmpdir.resolve('emoji-fruit-🍇 🍈 🍉 🍊 🍋'));
16+
assert.strictEqual(fs.existsSync(tempdir), true);
17+
18+
const filename = '🚀🔥🛸.txt';
19+
const content = 'Test content';
20+
21+
// Write content to a file
22+
fs.writeFileSync(path.join(tempdir, filename), content);
23+
24+
// Read content from the file
25+
const readContent = fs.readFileSync(path.join(tempdir, filename), 'utf8');
26+
27+
// Check if the content matches
28+
assert.strictEqual(readContent, content);
29+
30+
});
31+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.