mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 11:07:46 +00:00
main: add tests
Add testing infrastructure and one initial test (for src/runtime/print.go). More tests to be added later.
This commit is contained in:
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
// test basic printing
|
||||
println("hello world!")
|
||||
println(42)
|
||||
println(100000000)
|
||||
|
||||
// check that this one doesn't print an extra space between args
|
||||
print("a", "b", "c")
|
||||
println()
|
||||
// ..but this one does
|
||||
println("a", "b", "c")
|
||||
|
||||
// print integers
|
||||
println(uint8(123))
|
||||
println(int8(123))
|
||||
println(int8(-123))
|
||||
println(uint16(12345))
|
||||
println(int16(12345))
|
||||
println(int16(-12345))
|
||||
println(uint32(12345678))
|
||||
println(int32(12345678))
|
||||
println(int32(-12345678))
|
||||
println(uint64(123456789012))
|
||||
println(int64(123456789012))
|
||||
println(int64(-123456789012))
|
||||
|
||||
// print float64
|
||||
println(3.14)
|
||||
|
||||
// print map
|
||||
println(map[string]int{"three": 3, "five": 5})
|
||||
|
||||
// TODO: print pointer
|
||||
|
||||
// print bool
|
||||
println(true, false)
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
hello world!
|
||||
42
|
||||
100000000
|
||||
abc
|
||||
a b c
|
||||
123
|
||||
123
|
||||
-123
|
||||
12345
|
||||
12345
|
||||
-12345
|
||||
12345678
|
||||
12345678
|
||||
-12345678
|
||||
123456789012
|
||||
123456789012
|
||||
-123456789012
|
||||
+3.140000e+000
|
||||
map[2]
|
||||
true false
|
||||
Reference in New Issue
Block a user