@@ -54,29 +54,24 @@ describe('tabtab.log', () => {
54
54
} ) ;
55
55
56
56
it ( 'tabtab.log normalize String and Objects, with description stripped out on Bash' , ( ) => {
57
- const shell = process . env . SHELL ;
58
- process . env . SHELL = '/bin/bash' ;
59
57
const logs = logTestHelper ( [
60
58
{ name : '--foo' , description : 'Foo options' } ,
61
59
{ name : '--bar' , description : 'Bar option' } ,
62
60
'foobar' ,
63
61
'barfoo:barfoo is not foobar'
64
- ] ) ;
62
+ ] , 'bash' ) ;
65
63
66
64
assert . equal ( logs . length , 4 ) ;
67
65
assert . deepStrictEqual ( logs , [ '--foo' , '--bar' , 'foobar' , 'barfoo' ] ) ;
68
- process . env . SHELL = shell ;
69
66
} ) ;
70
67
71
68
it ( 'tabtab.log with description NOT stripped out on Zsh' , ( ) => {
72
- const shell = process . env . SHELL ;
73
- process . env . SHELL = '/usr/bin/zsh' ;
74
69
const logs = logTestHelper ( [
75
70
{ name : '--foo' , description : 'Foo option' } ,
76
71
{ name : '--bar' , description : 'Bar option' } ,
77
72
'foobar' ,
78
73
'barfoo:barfoo is not foobar'
79
- ] ) ;
74
+ ] , 'zsh' ) ;
80
75
81
76
assert . equal ( logs . length , 4 ) ;
82
77
assert . deepStrictEqual ( logs , [
@@ -85,18 +80,15 @@ describe('tabtab.log', () => {
85
80
'foobar' ,
86
81
'barfoo:barfoo is not foobar'
87
82
] ) ;
88
- process . env . SHELL = shell ;
89
83
} ) ;
90
84
91
85
it ( 'tabtab.log with description NOT stripped out on fish' , ( ) => {
92
- const shell = process . env . SHELL ;
93
- process . env . SHELL = '/usr/bin/fish' ;
94
86
const logs = logTestHelper ( [
95
87
{ name : '--foo' , description : 'Foo option' } ,
96
88
{ name : '--bar' , description : 'Bar option' } ,
97
89
'foobar' ,
98
90
'barfoo:barfoo is not foobar'
99
- ] ) ;
91
+ ] , 'fish' ) ;
100
92
101
93
assert . equal ( logs . length , 4 ) ;
102
94
assert . deepStrictEqual ( logs , [
@@ -105,18 +97,15 @@ describe('tabtab.log', () => {
105
97
'foobar' ,
106
98
'barfoo\tbarfoo is not foobar'
107
99
] ) ;
108
- process . env . SHELL = shell ;
109
100
} ) ;
110
101
111
102
it ( 'tabtab.log could use {name, description} for completions with ":" in them' , ( ) => {
112
- const shell = process . env . SHELL ;
113
- process . env . SHELL = '/usr/bin/zsh' ;
114
103
const logs = logTestHelper ( [
115
104
{ name : '--foo:bar' , description : 'Foo option' } ,
116
105
{ name : '--bar:foo' , description : 'Bar option' } ,
117
106
'foobar' ,
118
107
'barfoo:barfoo is not foobar'
119
- ] ) ;
108
+ ] , 'zsh' ) ;
120
109
121
110
assert . equal ( logs . length , 4 ) ;
122
111
assert . deepStrictEqual ( logs , [
@@ -125,25 +114,21 @@ describe('tabtab.log', () => {
125
114
'foobar' ,
126
115
'barfoo:barfoo is not foobar'
127
116
] ) ;
128
- process . env . SHELL = shell ;
129
117
} ) ;
130
118
131
119
it ( 'tabtab.log should escape ":" when name is given as an object without description' , ( ) => {
132
- const shell = process . env . SHELL ;
133
- process . env . SHELL = '/usr/bin/zsh' ;
134
120
const logs = logTestHelper ( [
135
121
'foo:bar' ,
136
122
{ name : 'foo:bar' } ,
137
123
{ name : 'foo:bar' , description : 'A command' } ,
138
124
{ name : 'foo:bar' , description : 'The foo:bar command' }
139
- ] ) ;
125
+ ] , 'zsh' ) ;
140
126
141
127
assert . deepStrictEqual ( logs , [
142
128
'foo:bar' ,
143
129
'foo\\:bar' ,
144
130
'foo\\:bar:A command' ,
145
131
'foo\\:bar:The foo\\:bar command'
146
132
] ) ;
147
- process . env . SHELL = shell ;
148
133
} ) ;
149
134
} ) ;
0 commit comments