Conthego. A lightweight implementation of a Specification By Example (SBE) framework in go. Inspired by concordion.org.
The package can be imported as github.com/fanovilla/conthego/conthego
.
See examples in the examples
directory.
Sample specification AssertEquals.md
[Hello World!](- "?GetGreeting()")
Sample fixture AssertEquals_test.go
import (
"github.com/fanovilla/conthego/conthego"
"testing"
)
func TestAssertEquals(t *testing.T) {
conthego.RunSpec(t, &AssertEqualsFixture{})
}
type AssertEqualsFixture struct {
}
func (f *AssertEqualsFixture) GetGreeting() string {
return "Hello World!"
}
Sample output:
set
[World](- "var1")
echo
[ ](- "$var1")
[ ](- "$var1.prop2")
[ ](- "$Hello()")
[ ](- "$Hello(var1)")
[ ](- "$$rawHtmlToEmbed")
exec
[ ](- "Hello()")
[Blah](- "var1=Hello(TEXT)")
[ ](- "var2=Hello(var1)")
assert-true or assert-equals
[World](- "?Hello()")
[World](- "?var1")
[World](- "?var1.prop")
directives
[ ](- "!ExpectedToFail")
See TODOs
See table examples in the examples
directory.
- commands processed via depth-first traversal (e.g. vars can only be used after setting)
- column commands processed left to right
- empty link text currently require a single space (e.g. use
[ ]
not[]
) - echo command uses a
$
prefix (notc:echo=
) - assert command uses a
?
prefix (not?=
) - set command uses no prefix (no
#
) - params for method calls uses no prefix (no
#
) - params for method calls bound as strings; please convert as per need in fixture methods
- fixture methods required to return a value, current limitation
- struct properties to assert on must be exported (dependent on json marshal behaviour)