| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8bfb8f5 commit 1743d2b
1 file changed
| Original file line number | Diff line number | Diff 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 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments