Ginkgo Testing Framework

Qualified uses the Ginkgo BDD testing framework with Gomega matcher library.

Test Structure

package challenge // import "qualified.io/challenge"

func Add(a, b int) int {
  return a + b
}
package challenge_test

import (
  . "github.com/onsi/ginkgo"
  . "github.com/onsi/gomega"
  . "qualified.io/challenge"
)

var _ = Describe("Add", func() {
  It("should add integers", func() {
    Expect(Add(1, 1)).To(Equal(2))
  })
})

Notes

The package name (challenge in above example) can be arbitrary ([a-z][a-z\d]*).

The import path can be configured with canonical import path. The default is codewarrior/{package name}.

Preloaded code is just another file in the challenge package and can be used to add auxiliary code callable from the solution or test suite:

package challenge // import "qualified.io/challenge"

func MeaningOfLife() int {
  return 42
}

Matchers

Expect(ACTUAL).To(M)
Expect(ACTUAL).ToNot(M)
Expect(ACTUAL).NotTo(M)