@@ -97,12 +97,12 @@ suite('SnippetParser', () => {
97
97
function assertMarker ( input : TextmateSnippet | Marker [ ] | string , ...ctors : Function [ ] ) {
98
98
let marker : Marker [ ] ;
99
99
if ( input instanceof TextmateSnippet ) {
100
- marker = input . children ;
100
+ marker = [ ... input . children ] ;
101
101
} else if ( typeof input === 'string' ) {
102
102
const p = new SnippetParser ( ) ;
103
103
marker = p . parse ( input ) . children ;
104
104
} else {
105
- marker = input ;
105
+ marker = [ ... input ] ;
106
106
}
107
107
while ( marker . length > 0 ) {
108
108
const m = marker . pop ( ) ;
@@ -273,12 +273,13 @@ suite('SnippetParser', () => {
273
273
assertTextAndMarker ( '${1|one,two,three,|}' , '${1|one,two,three,|}' , Text ) ;
274
274
assertTextAndMarker ( '${1|one,' , '${1|one,' , Text ) ;
275
275
276
- const p = new SnippetParser ( ) ;
277
- const snippet = p . parse ( '${1|one,two,three|}' ) ;
278
- assertMarker ( snippet , Placeholder ) ;
279
- const expected = [ Placeholder , Text , Text , Text ] ;
276
+ const snippet = new SnippetParser ( ) . parse ( '${1|one,two,three|}' ) ;
277
+ const expected : ( ( m : Marker ) => boolean ) [ ] = [
278
+ m => m instanceof Placeholder ,
279
+ m => m instanceof Choice && m . options . length === 3 && m . options . every ( x => x instanceof Text ) ,
280
+ ] ;
280
281
snippet . walk ( marker => {
281
- assert . strictEqual ( marker , expected . shift ( ) ) ;
282
+ assert . ok ( expected . shift ( ) ! ( marker ) ) ;
282
283
return true ;
283
284
} ) ;
284
285
} ) ;
0 commit comments