Skip to content

Commit

Permalink
feat(tools): add tools framework library package
Browse files Browse the repository at this point in the history
  • Loading branch information
kuwas committed Dec 10, 2019
1 parent 954d934 commit d6e8e86
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 0 deletions.
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/kuwas-io/etc.commons.go

go 1.13

require (
github.com/onsi/ginkgo v1.10.3
github.com/onsi/gomega v1.7.1
)
23 changes: 23 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.3 h1:OoxbjfXVZyod1fmWYhI7SEyaD8B00ynP3T+D5GiyHOY=
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
14 changes: 14 additions & 0 deletions src/tools/default.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @imports */
package tools
import ( "io/ioutil" )

/** @parameters */
var title = "Tools"

/** @exports */
func Default( s string ) ( string , error ) {
var e error
var o [] byte
if o , e = ioutil.ReadFile( s ) ; e != nil { return "" , e }
return string( o ) , nil
}
13 changes: 13 additions & 0 deletions src/tools/describe.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @imports */
package tools
import ( "github.com/onsi/ginkgo" )

/** @parameters */
/** @exports */
func Describe( s string , c func() , b func() , a func() ) bool {
var t = Title( [] string { s } , true )
return ginkgo.Describe( t , func() {
ginkgo.BeforeEach( b ) ; c() ;
ginkgo.AfterEach( a ) ;
})
}
9 changes: 9 additions & 0 deletions src/tools/should.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @imports */
package tools
import ( "github.com/onsi/ginkgo" )

/** @parameters */
/** @exports */
func Should( s string , c func() ) bool {
return ginkgo.It( "should return results " + s , c )
}
15 changes: 15 additions & 0 deletions src/tools/suite.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @imports */
package tools
import (
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
"testing"
)

/** @parameters */
/** @exports */
func Suite( s string , c * testing.T ) bool {
var t = Title( [] string { s } , false )
gomega.RegisterFailHandler( ginkgo.Fail )
return ginkgo.RunSpecs( c , t )
}
12 changes: 12 additions & 0 deletions src/tools/title.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @imports */
package tools
import ( "strings" )

/** @parameters */
/** @exports */
func Title( s [] string , t bool ) string {
var d = " »"
var o = strings.Join( s , d )
if t { o += d }
return o
}

0 comments on commit d6e8e86

Please sign in to comment.