-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(txtar): add
loadpkg
command (#1598)
- Loading branch information
Showing
13 changed files
with
331 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ package bar | |
|
||
func Render(path string) string { | ||
return "hello from foo" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
loadpkg gno.land/p/demo/ufmt | ||
|
||
# start a new node | ||
gnoland start | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
gno.land/cmd/gnoland/testdata/import.txtar → ...and/pkg/integration/testdata/import.txtar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# load a package from the example packages directory. | ||
loadpkg gno.land/p/demo/ufmt | ||
|
||
## start a new node | ||
gnoland start | ||
|
||
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/importtest -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | ||
stdout OK! | ||
|
||
## execute Render | ||
gnokey maketx call -pkgpath gno.land/r/importtest -func Render -gas-fee 1000000ugnot -gas-wanted 2000000 -args '' -broadcast -chainid=tendermint_test test1 | ||
stdout '("92054" string)' | ||
stdout OK! | ||
|
||
-- gno.mod -- | ||
module gno.land/r/importtest | ||
|
||
-- import.gno -- | ||
package importtest | ||
|
||
import ( | ||
"gno.land/p/demo/ufmt" | ||
) | ||
|
||
func Render(_ string) string { | ||
return ufmt.Sprintf("%d", 92054) | ||
} | ||
|
23 changes: 23 additions & 0 deletions
23
gno.land/pkg/integration/testdata/loadpkg_example_and_work.txtar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# load a package from the example packages directory. | ||
loadpkg gno.land/p/demo/ufmt | ||
loadpkg gno.land/r/importtest $WORK | ||
|
||
## start a new node | ||
gnoland start | ||
|
||
## execute Render | ||
gnokey maketx call -pkgpath gno.land/r/importtest -func Render -gas-fee 1000000ugnot -gas-wanted 2000000 -args '' -broadcast -chainid=tendermint_test test1 | ||
stdout '("92054" string)' | ||
stdout OK! | ||
|
||
-- import.gno -- | ||
package importtest | ||
|
||
import ( | ||
"gno.land/p/demo/ufmt" | ||
) | ||
|
||
func Render(_ string) string { | ||
return ufmt.Sprintf("%d", 92054) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
loadpkg gno.land/r/foobar/bar $WORK/bar | ||
|
||
## start a new node | ||
gnoland start | ||
|
||
## execute Render | ||
gnokey maketx run -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 $WORK/script/script.gno | ||
|
||
## compare render | ||
stdout 'main: --- hello from foo ---' | ||
stdout 'OK!' | ||
stdout 'GAS WANTED: 200000' | ||
stdout 'GAS USED: ' | ||
|
||
-- bar/bar.gno -- | ||
package bar | ||
|
||
func Render(path string) string { | ||
return "hello from foo" | ||
} | ||
|
||
-- script/script.gno -- | ||
package main | ||
|
||
import "gno.land/r/foobar/bar" | ||
|
||
func main() { | ||
println("main: ---", bar.Render(""), "---") | ||
} |
Oops, something went wrong.