BDD-style testing library for Golang
Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE.txt
README.md
dsl.go
dsl_test.go
example.go
example_group.go
expectation.go
formatter.go

README.md

Gospel

BDD-style testing library for Golang.

Install

go get github.com/r7kamura/gospel

Usage

package main

import (
	. "github.com/r7kamura/gospel"
	"testing"
)

func TestDescribe(t *testing.T) {
	Describe(t, "Expectation#To", func() {
		Context("with Equal", func() {
			It("evaluates actual == expected", func() {
				Expect(1).To(Equal, 1)
			})
		})

		Context("with NotEqual", func() {
			Before(func() {
				// Called before each examples in this Context.
			})

			After(func() {
				// Called after each examples in this Context.
			})

			It("evaluates actual != expected", func() {
				Expect(1).To(NotEqual, 2)
			})
		})

		Context("with Exist", func() {
			It("evaluates actual != nil", func() {
				Expect(1).To(Exist)
			})
		})

		Context("with NotExist", func() {
			It("evaluates actual == nil", func() {
				Expect(nil).To(NotExist)
			})
		})
	})
}
$ go test

$ go test -v