negate: add test

This commit is contained in:
Marc Vertes
2018-07-03 16:21:15 +02:00
parent 6277727660
commit e5ca673fec
2 changed files with 30 additions and 0 deletions

11
_test/neg0.go Normal file
View File

@@ -0,0 +1,11 @@
package main
import "fmt"
func main() {
a := -1
fmt.Println(a)
}
// Output:
// -1

View File

@@ -1396,6 +1396,25 @@ func main() {
// in foo hello 3
}
func Example_neg0() {
src := `
package main
import "fmt"
func main() {
a := -1
fmt.Println(a)
}
`
i := NewInterpreter(Opt{Entry: "main"})
i.ImportBin(export.Pkg)
i.Eval(src)
// Output:
// -1
}
func Example_plugin0() {
src := `
package sample