Skip to content

Commit

Permalink
Merge pull request #701 from Golmote/tests-go
Browse files Browse the repository at this point in the history
Add tests for Go
  • Loading branch information
Golmote committed Aug 27, 2015
2 parents 7c758ec + 29bb9aa commit eac42a9
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/languages/go/boolean_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
_
iota
nil
true
false

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

[
["boolean", "_"],
["boolean", "iota"],
["boolean", "nil"],
["boolean", "true"],
["boolean", "false"]
]

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

Checks for all boolean values.
79 changes: 79 additions & 0 deletions tests/languages/go/builtin_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
bool
byte
complex64
complex128
error
float32
float64
rune
string
int
int8
int16
int32
int64
uint
uint8
uint16
uint32
uint64
uintptr
append
cap
close
complex
copy
delete
imag
len
make
new
panic
print
println
real
recover

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

[
["builtin", "bool"],
["builtin", "byte"],
["builtin", "complex64"],
["builtin", "complex128"],
["builtin", "error"],
["builtin", "float32"],
["builtin", "float64"],
["builtin", "rune"],
["builtin", "string"],
["builtin", "int"],
["builtin", "int8"],
["builtin", "int16"],
["builtin", "int32"],
["builtin", "int64"],
["builtin", "uint"],
["builtin", "uint8"],
["builtin", "uint16"],
["builtin", "uint32"],
["builtin", "uint64"],
["builtin", "uintptr"],
["builtin", "append"],
["builtin", "cap"],
["builtin", "close"],
["builtin", "complex"],
["builtin", "copy"],
["builtin", "delete"],
["builtin", "imag"],
["builtin", "len"],
["builtin", "make"],
["builtin", "new"],
["builtin", "panic"],
["builtin", "print"],
["builtin", "println"],
["builtin", "real"],
["builtin", "recover"]
]

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

Checks for all builtins.
59 changes: 59 additions & 0 deletions tests/languages/go/keyword_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
break
case
chan
const
continue
default
defer
else
fallthrough
for
func
go
goto
if
import
interface
map
package
range
return
select
struct
switch
type
var

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

[
["keyword", "break"],
["keyword", "case"],
["keyword", "chan"],
["keyword", "const"],
["keyword", "continue"],
["keyword", "default"],
["keyword", "defer"],
["keyword", "else"],
["keyword", "fallthrough"],
["keyword", "for"],
["keyword", "func"],
["keyword", "go"],
["keyword", "goto"],
["keyword", "if"],
["keyword", "import"],
["keyword", "interface"],
["keyword", "map"],
["keyword", "package"],
["keyword", "range"],
["keyword", "return"],
["keyword", "select"],
["keyword", "struct"],
["keyword", "switch"],
["keyword", "type"],
["keyword", "var"]
]

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

Checks for all keywords
43 changes: 43 additions & 0 deletions tests/languages/go/number_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
42
0600
0xBadFace
170141183460469231731687303715884105727
72.40
072.40
2.71828
1.e+0
6.67428e-11
1E6
0i
011i
0.i
2.71828i
1.e+0i
6.67428e-11i
1E6i

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

[
["number", "42"],
["number", "0600"],
["number", "0xBadFace"],
["number", "170141183460469231731687303715884105727"],
["number", "72.40"],
["number", "072.40"],
["number", "2.71828"],
["number", "1.e+0"],
["number", "6.67428e-11"],
["number", "1E6"],
["number", "0i"],
["number", "011i"],
["number", "0.i"],
["number", "2.71828i"],
["number", "1.e+0i"],
["number", "6.67428e-11i"],
["number", "1E6i"]
]

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

Checks for integers, floats and imaginary numbers.
27 changes: 27 additions & 0 deletions tests/languages/go/operator_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
* / % ^ ! =
*= /= %= ^= != ==
+ += ++
- -= --
| |= ||
& &= && &^ &^=
> >> >>= >=
< << <<= <= <-
:= ...

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

[
["operator", "*"], ["operator", "/"], ["operator", "%"], ["operator", "^"], ["operator", "!"], ["operator", "="],
["operator", "*="], ["operator", "/="], ["operator", "%="], ["operator", "^="], ["operator", "!="], ["operator", "=="],
["operator", "+"], ["operator", "+="], ["operator", "++"],
["operator", "-"], ["operator", "-="], ["operator", "--"],
["operator", "|"], ["operator", "|="], ["operator", "||"],
["operator", "&"], ["operator", "&="], ["operator", "&&"], ["operator", "&^"], ["operator", "&^="],
["operator", ">"], ["operator", ">>"], ["operator", ">>="], ["operator", ">="],
["operator", "<"], ["operator", "<<"], ["operator", "<<="], ["operator", "<="], ["operator", "<-"],
["operator", ":="], ["operator", "..."]
]

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

Checks for all operators.
37 changes: 37 additions & 0 deletions tests/languages/go/string_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'a'
'ä'
'本'
'\t'
'\xff'
'\u12e4'

`abc`
`\n
\n`
"\n"
"\""
"Hello, world!\n"
"日本語"
"\xff\u00FF"

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

[
["string", "'a'"],
["string", "'ä'"],
["string", "'本'"],
["string", "'\\t'"],
["string", "'\\xff'"],
["string", "'\\u12e4'"],
["string", "`abc`"],
["string", "`\\n\r\n\\n`"],
["string", "\"\\n\""],
["string", "\"\\\"\""],
["string", "\"Hello, world!\\n\""],
["string", "\"日本語\""],
["string", "\"\\xff\\u00FF\""]
]

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

Checks for runes and strings.

0 comments on commit eac42a9

Please sign in to comment.