@@ -65,52 +65,51 @@ suite('ShellIntegrationAddon', () => {
65
65
mock . verify ( ) ;
66
66
} ) ;
67
67
68
- suite ( 'detect `OSC 7; scheme://cwd ST`' , async ( ) => {
69
- suite ( 'should extract CWD from URL format' , async ( ) => {
70
- test ( 'should accept well-formatted URLs' , async ( ) => {
71
- type TestCase = [ title : string , input : string , expected : string ] ;
72
- const cases : TestCase [ ] = [
73
- // Different hostname values:
74
- [ 'empty hostname, pointing root' , 'file:///' , '/' ] ,
75
- [ 'empty hostname' , 'file:///test-root/local' , '/test-root/local' ] ,
76
- [ 'non-empty hostname' , 'file://some-hostname/test-root/local' , '/test-root/local' ] ,
77
- // URL-encoded chars:
78
- [ 'URL-encoded value (1)' , 'file:///test-root/%6c%6f%63%61%6c' , '/test-root/local' ] ,
79
- [ 'URL-encoded value (2)' , 'file:///test-root/local%22' , '/test-root/local"' ] ,
80
- [ 'URL-encoded value (3)' , 'file:///test-root/local"' , '/test-root/local"' ] ,
81
- ] ;
82
- for ( const x of cases ) {
83
- const [ title , input , expected ] = x ;
84
- const mock = shellIntegrationAddon . getCwdDectionMock ( ) ;
85
- mock . expects ( 'updateCwd' ) . once ( ) . withExactArgs ( expected ) . named ( title ) ;
86
- await writeP ( xterm , `\x1b]7;${ input } \x07` ) ;
87
- mock . verify ( ) ;
88
- }
89
- } ) ;
68
+ suite ( 'detect `SetCwd` sequence: `OSC 7; scheme://cwd ST`' , async ( ) => {
90
69
91
- test ( 'should ignore ill-formatted URLs' , async ( ) => {
92
- type TestCase = [ title : string , input : string ] ;
93
- const cases : TestCase [ ] = [
94
- // Different hostname values:
95
- [ 'no hostname, pointing root' , 'file://' ] ,
96
- // Non-`file` scheme values:
97
- [ 'no scheme (1)' , '/test-root' ] ,
98
- [ 'no scheme (2)' , '//test-root' ] ,
99
- [ 'no scheme (3)' , '///test-root' ] ,
100
- [ 'no scheme (4)' , ':///test-root' ] ,
101
- [ 'http' , 'http:///test-root' ] ,
102
- [ 'ftp' , 'ftp:///test-root' ] ,
103
- [ 'ssh' , 'ssh:///test-root' ] ,
104
- ] ;
70
+ test ( 'should accept well-formatted URLs' , async ( ) => {
71
+ type TestCase = [ title : string , input : string , expected : string ] ;
72
+ const cases : TestCase [ ] = [
73
+ // Different hostname values:
74
+ [ 'empty hostname, pointing root' , 'file:///' , '/' ] ,
75
+ [ 'empty hostname' , 'file:///test-root/local' , '/test-root/local' ] ,
76
+ [ 'non-empty hostname' , 'file://some-hostname/test-root/local' , '/test-root/local' ] ,
77
+ // URL-encoded chars:
78
+ [ 'URL-encoded value (1)' , 'file:///test-root/%6c%6f%63%61%6c' , '/test-root/local' ] ,
79
+ [ 'URL-encoded value (2)' , 'file:///test-root/local%22' , '/test-root/local"' ] ,
80
+ [ 'URL-encoded value (3)' , 'file:///test-root/local"' , '/test-root/local"' ] ,
81
+ ] ;
82
+ for ( const x of cases ) {
83
+ const [ title , input , expected ] = x ;
84
+ const mock = shellIntegrationAddon . getCwdDectionMock ( ) ;
85
+ mock . expects ( 'updateCwd' ) . once ( ) . withExactArgs ( expected ) . named ( title ) ;
86
+ await writeP ( xterm , `\x1b]7;${ input } \x07` ) ;
87
+ mock . verify ( ) ;
88
+ }
89
+ } ) ;
90
+
91
+ test ( 'should ignore ill-formatted URLs' , async ( ) => {
92
+ type TestCase = [ title : string , input : string ] ;
93
+ const cases : TestCase [ ] = [
94
+ // Different hostname values:
95
+ [ 'no hostname, pointing root' , 'file://' ] ,
96
+ // Non-`file` scheme values:
97
+ [ 'no scheme (1)' , '/test-root' ] ,
98
+ [ 'no scheme (2)' , '//test-root' ] ,
99
+ [ 'no scheme (3)' , '///test-root' ] ,
100
+ [ 'no scheme (4)' , ':///test-root' ] ,
101
+ [ 'http' , 'http:///test-root' ] ,
102
+ [ 'ftp' , 'ftp:///test-root' ] ,
103
+ [ 'ssh' , 'ssh:///test-root' ] ,
104
+ ] ;
105
105
106
- for ( const x of cases ) {
107
- const [ title , input ] = x ;
108
- const mock = shellIntegrationAddon . getCwdDectionMock ( ) ;
109
- mock . expects ( 'updateCwd' ) . never ( ) . named ( title ) ;
110
- await writeP ( xterm , `\x1b]7;${ input } \x07` ) ;
111
- mock . verify ( ) ;
112
- }
113
- } ) ;
106
+ for ( const x of cases ) {
107
+ const [ title , input ] = x ;
108
+ const mock = shellIntegrationAddon . getCwdDectionMock ( ) ;
109
+ mock . expects ( 'updateCwd' ) . never ( ) . named ( title ) ;
110
+ await writeP ( xterm , `\x1b]7;${ input } \x07` ) ;
111
+ mock . verify ( ) ;
112
+ }
114
113
} ) ;
115
114
} ) ;
116
115
0 commit comments