Mercurial > hg > Members > anatofuz > monkey
changeset 1:a1166907ac2d master
add calc test
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 15 May 2020 10:20:57 +0900 |
parents | 72d22ea56795 |
children | 595b3e2dc94e |
files | lexer/lexer_test.go token/token.go |
diffstat | 2 files changed, 42 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lexer/lexer_test.go Fri May 15 10:12:16 2020 +0900 +++ b/lexer/lexer_test.go Fri May 15 10:20:57 2020 +0900 @@ -14,6 +14,8 @@ }; let result = add(five, ten); + !-/*5; + 5 < 10 > 5; ` tests := []struct { @@ -36,6 +38,38 @@ {token.FUNCTION, "fn"}, {token.LPAREN, "("}, {token.IDENT, "x"}, + {token.COMMA, ","}, + {token.IDENT, "y"}, + {token.RPAREN, ")"}, + {token.LBRACE, "{"}, + {token.IDENT, "x"}, + {token.PLUS, "+"}, + {token.IDENT, "y"}, + {token.SEMICOLON, ";"}, + {token.RBRACE, "}"}, + {token.SEMICOLON, ";"}, + {token.LET, "let"}, + {token.IDENT, "result"}, + {token.ASSIGN, "="}, + {token.IDENT, "add"}, + {token.LPAREN, "("}, + {token.IDENT, "five"}, + {token.COMMA, ","}, + {token.IDENT, "ten"}, + {token.RPAREN, ")"}, + {token.SEMICOLON, ";"}, + {token.BANG, "!"}, + {token.MINUS, "-"}, + {token.SLASH, "/"}, + {token.ASTERISK, "*"}, + {token.INT, "5"}, + {token.SEMICOLON, ";"}, + {token.INT, "5"}, + {token.LT, "<"}, + {token.INT, "10"}, + {token.GT, ">"}, + {token.SEMICOLON, ";"}, + {token.EOF, ""}, } l := New(input)