testutil

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2015 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

ユニットテスト支援ユーティリティのパッケージ。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBaseDir

func GetBaseDir() string

Types

type AddrStub

type AddrStub struct {
	// contains filtered or unexported fields
}

net.Addrのスタブ構造体

func NewAddrStub

func NewAddrStub(str string) *AddrStub

func (*AddrStub) Network

func (a *AddrStub) Network() string

func (*AddrStub) String

func (a *AddrStub) String() string

type Capturer

type Capturer struct {
	// contains filtered or unexported fields
}

標準出力・標準エラー出力のキャプチャを行う構造体

func NewStderrCapturer

func NewStderrCapturer() *Capturer

標準エラー出力をキャプチャするCapturerを生成する。

return : 生成したCapturerオブジェクト

func NewStdoutCapturer

func NewStdoutCapturer() *Capturer

標準出力をキャプチャするCapturerを生成する。

return : 生成したCapturerオブジェクト

func (*Capturer) Start

func (c *Capturer) Start()

キャプチャを開始する。

func (*Capturer) Stop

func (c *Capturer) Stop() string

キャプチャを停止する。

return : キャプチャ開始から停止までの間に出力された文字列

type ConnStub

type ConnStub struct {
	ReadStr             string // Read関数で取得させる文字列
	WriteStr            string // Write関数で書き込まれた文字列
	ReadErr             error
	WriteErr            error
	CloseErr            error
	SetDeadlineErr      error
	SetReadDeadlineErr  error
	SetWriteDeadlineErr error
	IsClosed            bool
	// contains filtered or unexported fields
}

net.Connのスタブ構造体

func NewConnStub

func NewConnStub() *ConnStub

func (*ConnStub) Close

func (c *ConnStub) Close() error

func (*ConnStub) LocalAddr

func (c *ConnStub) LocalAddr() net.Addr

func (*ConnStub) Read

func (c *ConnStub) Read(b []byte) (n int, err error)

func (*ConnStub) RemoteAddr

func (c *ConnStub) RemoteAddr() net.Addr

func (*ConnStub) SetDeadline

func (c *ConnStub) SetDeadline(t time.Time) error

func (*ConnStub) SetReadDeadline

func (c *ConnStub) SetReadDeadline(t time.Time) error

func (*ConnStub) SetWriteDeadline

func (c *ConnStub) SetWriteDeadline(t time.Time) error

func (*ConnStub) Write

func (c *ConnStub) Write(b []byte) (n int, err error)

type ListenerStub

type ListenerStub struct {
	AcceptErr error
	CloseErr  error
	IsClosed  bool
	// contains filtered or unexported fields
}

net.Listenerのスタブ構造体

func NewListenerStub

func NewListenerStub() *ListenerStub

func (*ListenerStub) Accept

func (l *ListenerStub) Accept() (c net.Conn, err error)

func (*ListenerStub) Addr

func (l *ListenerStub) Addr() net.Addr

func (*ListenerStub) Close

func (l *ListenerStub) Close() error

Jump to

Keyboard shortcuts

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