miniassert

package module
v0.0.0-...-bee6358 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2014 License: MIT Imports: 4 Imported by: 0

README

miniassert

Mini assert testing framework for the Go language

Usage

package hello

import (
  "testing"
  "errors"
  assert "github.com/pilu/miniassert"
)

type Foo struct {}

func Hello() string { return "Hello World" }

func TestSomething(t *testing.T) {
  assert.Equal(t, "Hello World", Hello())
  assert.True(t, true)
  assert.False(t, false)

  var err error
  assert.Nil(t, err)

  err = errors.New("foo")
  assert.NotNil(t, err)

  foo := &Foo{}
  assert.Type(t, "*hello.Foo", foo)
}

Run go test as usual.

Author

Documentation

Overview

package Miniassert is a small assert library.

Usage:

package hello

import (
  "testing"
  "errors"
  assert "github.com/pilu/miniassert"
)

type Foo struct {}

func Hello() string { return "Hello World" }

func TestSomething(t *testing.T) {
  assert.Equal(t, "Hello World", Hello())
  assert.True(t, true)
  assert.False(t, false)

  var err error
  assert.Nil(t, err)

  err = errors.New("foo")
  assert.NotNil(t, err)

  foo := &Foo{}
  assert.Type(t, "*hello.Foo", foo)
}

Run `go test` as usual.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(t *testing.T, expected, actual interface{})

func False

func False(t *testing.T, value interface{})

func Nil

func Nil(t *testing.T, value interface{})

func NotEqual

func NotEqual(t *testing.T, expected, actual interface{})

func NotNil

func NotNil(t *testing.T, value interface{})

func True

func True(t *testing.T, value interface{})

func Type

func Type(t *testing.T, expectedType string, value interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL