Skip to content

Commit

Permalink
Add tests for OCaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Sep 9, 2015
1 parent 9c1bdfe commit fca15ae
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/languages/ocaml/boolean_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
false
true

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

[
["boolean", "false"],
["boolean", "true"]
]

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

Checks for booleans.
14 changes: 14 additions & 0 deletions tests/languages/ocaml/comment_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(**)
(* foo
bar *)

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

[
["comment", "(**)"],
["comment", "(* foo\r\nbar *)"]
]

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

Checks for comments.
15 changes: 15 additions & 0 deletions tests/languages/ocaml/directive_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#quit
#load
#load_rec

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

[
["directive", "#quit"],
["directive", "#load"],
["directive", "#load_rec"]
]

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

Checks for directives.
101 changes: 101 additions & 0 deletions tests/languages/ocaml/keyword_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
as
assert
begin
class
constraint
do
done
downto
else
end
exception
external
for
fun
function
functor
if
in
include
inherit
initializer
lazy
let
match
method
module
mutable
new
object
of
open
prefix
private
rec
then
sig
struct
to
try
type
val
value
virtual
where
while
with

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

[
["keyword", "as"],
["keyword", "assert"],
["keyword", "begin"],
["keyword", "class"],
["keyword", "constraint"],
["keyword", "do"],
["keyword", "done"],
["keyword", "downto"],
["keyword", "else"],
["keyword", "end"],
["keyword", "exception"],
["keyword", "external"],
["keyword", "for"],
["keyword", "fun"],
["keyword", "function"],
["keyword", "functor"],
["keyword", "if"],
["keyword", "in"],
["keyword", "include"],
["keyword", "inherit"],
["keyword", "initializer"],
["keyword", "lazy"],
["keyword", "let"],
["keyword", "match"],
["keyword", "method"],
["keyword", "module"],
["keyword", "mutable"],
["keyword", "new"],
["keyword", "object"],
["keyword", "of"],
["keyword", "open"],
["keyword", "prefix"],
["keyword", "private"],
["keyword", "rec"],
["keyword", "then"],
["keyword", "sig"],
["keyword", "struct"],
["keyword", "to"],
["keyword", "try"],
["keyword", "type"],
["keyword", "val"],
["keyword", "value"],
["keyword", "virtual"],
["keyword", "where"],
["keyword", "while"],
["keyword", "with"]
]

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

Checks for keywords.
25 changes: 25 additions & 0 deletions tests/languages/ocaml/number_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
0xBad_Face
0o754_672
0b1010_1111
42_000
3.14_15_9
3.2e8
6.1E-7
0.4e+12_415

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

[
["number", "0xBad_Face"],
["number", "0o754_672"],
["number", "0b1010_1111"],
["number", "42_000"],
["number", "3.14_15_9"],
["number", "3.2e8"],
["number", "6.1E-7"],
["number", "0.4e+12_415"]
]

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

Checks for numbers.
31 changes: 31 additions & 0 deletions tests/languages/ocaml/operator_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
and asr land
lor lxor lsl lsr
mod nor or

:=
= < > @
^ | & ~
+ - * /
$ % ! ?

~=~

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

[
["operator", "and"], ["operator", "asr"], ["operator", "land"],
["operator", "lor"], ["operator", "lxor"], ["operator", "lsl"], ["operator", "lsr"],
["operator", "mod"], ["operator", "nor"], ["operator", "or"],

["operator", ":="],
["operator", "="], ["operator", "<"], ["operator", ">"], ["operator", "@"],
["operator", "^"], ["operator", "|"], ["operator", "&"], ["operator", "~"],
["operator", "+"], ["operator", "-"], ["operator", "*"], ["operator", "/"],
["operator", "$"], ["operator", "%"], ["operator", "!"], ["operator", "?"],

["operator", "~=~"]
]

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

Checks for operators.
25 changes: 25 additions & 0 deletions tests/languages/ocaml/string_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
""
"Fo\"obar"
'\''
'\123'
'\xf4'
`\``
`\123`
`\xf4`

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

[
["string", "\"\""],
["string", "\"Fo\\\"obar\""],
["string", "'\\''"],
["string", "'\\123'"],
["string", "'\\xf4'"],
["string", "`\\``"],
["string", "`\\123`"],
["string", "`\\xf4`"]
]

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

Checks for strings.
17 changes: 17 additions & 0 deletions tests/languages/ocaml/type_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'Foo
'bar_42
`Foo
`bar_42

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

[
["type", "'Foo"],
["type", "'bar_42"],
["type", "`Foo"],
["type", "`bar_42"]
]

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

Checks for types.

0 comments on commit fca15ae

Please sign in to comment.