Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(precompile): add more cases #1640

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Run gno precompile with invalid gno files
# Run gno precompile with gno files with parse errors

! gno precompile .

! stdout .+
stderr 'precompile: parse: main.gno:3:1: expected declaration, found invalid'
stderr 'precompile: parse: sub/sub.gno:3:1: expected declaration, found invalid'

# no *.gen.go files are created
! exec test -f main.gno.gen.go
! exec test -f sub/sub.gno.gen.go

-- main.gno --
package main

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Run gno precompile with -gobuild flag on file with parse error

! gno precompile -gobuild .

! stdout .+
stderr 'main.gno: precompile: parse: main.gno:3:1: expected declaration, found invalid'

# no *.gen.go files are created
! exec test -f main.gno.gen.go

-- main.gno --
package main

invalid
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Run gno precompile with gno files with whitelist errors

! gno precompile .

! stdout .+
stderr 'main.gno: precompile: import "xxx" is not in the whitelist'
stderr 'sub/sub.gno: precompile: import "xxx" is not in the whitelist'

# no *.gen.go files are created
! exec test -f main.gno.gen.go
! exec test -f sub/sub.gno.gen.go

-- main.gno --
package main

import (
"std"
"xxx"
)

func main() {}

-- sub/sub.gno --
package sub

import "xxx"
Loading