Skip to content

Commit

Permalink
Add tests for Monkey
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Sep 7, 2015
1 parent 9379417 commit dd417d7
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/languages/monkey/comment_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
' Foobar
#Rem Foo
Bar 'Baz
#End

----------------------------------------------------

[
["comment", "' Foobar"],
["comment", "#Rem Foo\r\nBar 'Baz\r\n#End"]
]

----------------------------------------------------

Checks for comments.
13 changes: 13 additions & 0 deletions tests/languages/monkey/function_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
foobar()
Foo_Bar_42()

----------------------------------------------------

[
["function", "foobar"], ["punctuation", "("], ["punctuation", ")"],
["function", "Foo_Bar_42"], ["punctuation", "("], ["punctuation", ")"]
]

----------------------------------------------------

Checks for functions.
125 changes: 125 additions & 0 deletions tests/languages/monkey/keyword_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
Void
Strict
Public
Private
Property
Bool
Int
Float
String
Array
Object
Continue
Exit
Import
Extern
New
Self
Super
Try
Catch
Eachin
True
False
Extends
Abstract
Final
Select
Case
Default
Const
Local
Global
Field
Method
Function
Class
End
If
Then
Else
ElseIf
EndIf
While
Wend
Repeat
Until
Forever
For
To
Step
Next
Return
Module
Interface
Implements
Inline
Throw
Null

----------------------------------------------------

[
["keyword", "Void"],
["keyword", "Strict"],
["keyword", "Public"],
["keyword", "Private"],
["keyword", "Property"],
["keyword", "Bool"],
["keyword", "Int"],
["keyword", "Float"],
["keyword", "String"],
["keyword", "Array"],
["keyword", "Object"],
["keyword", "Continue"],
["keyword", "Exit"],
["keyword", "Import"],
["keyword", "Extern"],
["keyword", "New"],
["keyword", "Self"],
["keyword", "Super"],
["keyword", "Try"],
["keyword", "Catch"],
["keyword", "Eachin"],
["keyword", "True"],
["keyword", "False"],
["keyword", "Extends"],
["keyword", "Abstract"],
["keyword", "Final"],
["keyword", "Select"],
["keyword", "Case"],
["keyword", "Default"],
["keyword", "Const"],
["keyword", "Local"],
["keyword", "Global"],
["keyword", "Field"],
["keyword", "Method"],
["keyword", "Function"],
["keyword", "Class"],
["keyword", "End"],
["keyword", "If"],
["keyword", "Then"],
["keyword", "Else"],
["keyword", "ElseIf"],
["keyword", "EndIf"],
["keyword", "While"],
["keyword", "Wend"],
["keyword", "Repeat"],
["keyword", "Until"],
["keyword", "Forever"],
["keyword", "For"],
["keyword", "To"],
["keyword", "Step"],
["keyword", "Next"],
["keyword", "Return"],
["keyword", "Module"],
["keyword", "Interface"],
["keyword", "Implements"],
["keyword", "Inline"],
["keyword", "Throw"],
["keyword", "Null"]
]

----------------------------------------------------

Checks for keywords.
19 changes: 19 additions & 0 deletions tests/languages/monkey/number_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
0
42
3.14159
.5
$BadFace

----------------------------------------------------

[
["number", "0"],
["number", "42"],
["number", "3.14159"],
["number", ".5"],
["number", "$BadFace"]
]

----------------------------------------------------

Checks for numbers.
41 changes: 41 additions & 0 deletions tests/languages/monkey/operator_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
..
< <> <=
> >=
=
:=
+ +=
- -=
* *=
/ /=
& &=
~ ~=
| |=
Mod Mod=
Shl Shl=
Shr Shr=
And Not Or

----------------------------------------------------

[
["operator", ".."],
["operator", "<"], ["operator", "<>"], ["operator", "<="],
["operator", ">"], ["operator", ">="],
["operator", "="],
["operator", ":="],
["operator", "+"], ["operator", "+="],
["operator", "-"], ["operator", "-="],
["operator", "*"], ["operator", "*="],
["operator", "/"], ["operator", "/="],
["operator", "&"], ["operator", "&="],
["operator", "~"], ["operator", "~="],
["operator", "|"], ["operator", "|="],
["operator", "Mod"], ["operator", "Mod="],
["operator", "Shl"], ["operator", "Shl="],
["operator", "Shr"], ["operator", "Shr="],
["operator", "And"], ["operator", "Not"], ["operator", "Or"]
]

----------------------------------------------------

Checks for operators.
15 changes: 15 additions & 0 deletions tests/languages/monkey/preprocessor_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#If HOST
#ElseIf
#Else

----------------------------------------------------

[
["preprocessor", "#If HOST"],
["preprocessor", "#ElseIf"],
["preprocessor", "#Else"]
]

----------------------------------------------------

Checks for preprocessor directives.
13 changes: 13 additions & 0 deletions tests/languages/monkey/string_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
""
"Foo ~qBar~q"

----------------------------------------------------

[
["string", "\"\""],
["string", "\"Foo ~qBar~q\""]
]

----------------------------------------------------

Checks for strings.
17 changes: 17 additions & 0 deletions tests/languages/monkey/type-char_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
foo?
bar%
baz#
foobar$

----------------------------------------------------

[
"foo", ["type-char", "?"],
"\r\nbar", ["type-char", "%"],
"\r\nbaz", ["type-char", "#"],
"\r\nfoobar", ["type-char", "$"]
]

----------------------------------------------------

Checks for type chars.

0 comments on commit dd417d7

Please sign in to comment.