@@ -5180,6 +5180,50 @@ describe('Lexer: Third Milestone', function() {
5180
5180
expect ( lexer ( input ) ) . to . deep . equal ( output ) ;
5181
5181
} ) ;
5182
5182
5183
+ it ( 'should handle the min and max element methods' , function ( ) {
5184
+ input = String . raw `var arr = [1,2,3,4,5]
5185
+ var one = arr.minElement()
5186
+ var five = arr.maxElement()` ;
5187
+ output = [
5188
+ { type : "DECLARATION_KEYWORD" , value : "var" } ,
5189
+ { type : "IDENTIFIER" , value : "arr" } ,
5190
+ { type : "OPERATOR" , value : "=" } ,
5191
+ { type : "ARRAY_START" , value : "[" } ,
5192
+ { type : "NUMBER" , value : "1" } ,
5193
+ { type : "PUNCTUATION" , value : "," } ,
5194
+ { type : "NUMBER" , value : "2" } ,
5195
+ { type : "PUNCTUATION" , value : "," } ,
5196
+ { type : "NUMBER" , value : "3" } ,
5197
+ { type : "PUNCTUATION" , value : "," } ,
5198
+ { type : "NUMBER" , value : "4" } ,
5199
+ { type : "PUNCTUATION" , value : "," } ,
5200
+ { type : "NUMBER" , value : "5" } ,
5201
+ { type : "ARRAY_END" , value : "]" } ,
5202
+ { type : "TERMINATOR" , value : "\\n" } ,
5203
+
5204
+ { type : "DECLARATION_KEYWORD" , value : "var" } ,
5205
+ { type : "IDENTIFIER" , value : "one" } ,
5206
+ { type : "OPERATOR" , value : "=" } ,
5207
+ { type : "IDENTIFIER" , value : "arr" } ,
5208
+ { type : "DOT_SYNTAX" , value : "." } ,
5209
+ { type : "NATIVE_METHOD" , value : "minElement" } ,
5210
+ { type : "INVOCATION_START" , value : "(" } ,
5211
+ { type : "INVOCATION_END" , value : ")" } ,
5212
+ { type : "TERMINATOR" , value : "\\n" } ,
5213
+
5214
+ { type : "DECLARATION_KEYWORD" , value : "var" } ,
5215
+ { type : "IDENTIFIER" , value : "five" } ,
5216
+ { type : "OPERATOR" , value : "=" } ,
5217
+ { type : "IDENTIFIER" , value : "arr" } ,
5218
+ { type : "DOT_SYNTAX" , value : "." } ,
5219
+ { type : "NATIVE_METHOD" , value : "maxElement" } ,
5220
+ { type : "INVOCATION_START" , value : "(" } ,
5221
+ { type : "INVOCATION_END" , value : ")" } ,
5222
+ { type : "TERMINATOR" , value : "EOF" }
5223
+ ] ;
5224
+ expect ( lexer ( input ) ) . to . deep . equal ( output ) ;
5225
+ } ) ;
5226
+
5183
5227
} ) ;
5184
5228
5185
5229
} ) ;
0 commit comments