add test
This commit is contained in:
22
tests/build.sh
Executable file
22
tests/build.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
dir=$(dirname $(realpath $0))
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=direct
|
||||
export GOPATH=${dir}/buildenv/deps
|
||||
|
||||
mkdir -p ${dir}/buildenv
|
||||
chmod -R 755 ${dir}/buildenv
|
||||
rm -rf ${dir}/buildenv
|
||||
|
||||
mkdir -p "${dir}/buildenv/src"
|
||||
mkdir -p ${GOPATH}/src
|
||||
mkdir -p ${dir}/bin
|
||||
|
||||
cp -r "${dir}/main.go" "${dir}/buildenv/src/main.go"
|
||||
|
||||
cd ${dir}/buildenv
|
||||
|
||||
go mod init src
|
||||
go mod tidy
|
||||
|
||||
go build -o "${dir}/bin/test" "src/main.go"
|
13
tests/main.go
Normal file
13
tests/main.go
Normal file
@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
import ("git.purser.it/roypur/envconf"
|
||||
"fmt")
|
||||
|
||||
func main() {
|
||||
conf := envconf.NewConfig()
|
||||
conf.Define("this_is_a_map", envconf.FixedHex(22))
|
||||
conf.Parse()
|
||||
conf.Status()
|
||||
|
||||
fmt.Println(conf.GetHex("this_is_a_map"))
|
||||
}
|
Reference in New Issue
Block a user