File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const common = require ( '../common' ) ;
3+ const assert = require ( 'assert' ) ;
4+ const path = require ( 'path' ) ;
5+
6+ // هذا السطر يمنع تشغيل الاختبار على غير ويندوز لأنه خاص بويندوز فقط
7+ if ( ! common . isWindows )
8+ common . skip ( 'this test is for win32 only' ) ;
9+
10+ // Test cases for reserved device names missing the trailing colon
11+ // See: https://github.com/nodejs/node/pull/[YOUR_PR_NUMBER] (optional)
12+
13+ // 1. Check \\.\CON (Missing colon)
14+ assert . strictEqual ( path . win32 . normalize ( '\\\\.\\CON' ) , '\\\\.\\CON' ) ;
15+ assert . strictEqual ( path . win32 . normalize ( '\\\\.\\con' ) , '\\\\.\\con' ) ; // Case insensitive
16+
17+ // 2. Check \\?\CON (Missing colon)
18+ assert . strictEqual ( path . win32 . normalize ( '\\\\?\\CON' ) , '\\\\?\\CON' ) ;
19+ assert . strictEqual ( path . win32 . normalize ( '\\\\?\\con' ) , '\\\\?\\con' ) ;
20+
21+ // 3. Check that regular files are NOT affected (Sanity check)
22+ assert . strictEqual ( path . win32 . normalize ( '\\\\.\\PhysicalDrive0' ) , '\\\\.\\PhysicalDrive0' ) ;
23+
24+ // 4. Check join behavior (to ensure it acts as a root)
25+ // If it's a root, joining '..' should not strip the device.
26+ const joined = path . win32 . join ( '\\\\.\\CON' , '..' ) ;
27+ assert . strictEqual ( joined , '\\\\.\\CON' ) ;
You can’t perform that action at this time.
0 commit comments