gotest

package
v0.0.0-...-351e8d0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a int, b int) int

Add() 用于演示go test的使用方法

func MakeByErrorsNew

func MakeByErrorsNew() error

MakeByErrorsNew 方法

func MakeByFmtErrorf

func MakeByFmtErrorf() error

MakeByFmtErrorf 方法

func MakeSliceWithPreAlloc

func MakeSliceWithPreAlloc() []int

MakeSliceWithPreAlloc 通过预分配Slice的存储空间构造

func MakeSliceWithoutAlloc

func MakeSliceWithoutAlloc() []int

MakeSliceWithPreAlloc 不预分配

func PrintNames

func PrintNames()

PrintNames 打印学生姓名

Example

检测乱序输出

package main

import (
	"github.com/stevenlee87/go-daily-lib/expert_programming/chapter7/7.1_quick_start/gotest"
)

func main() {
	gotest.PrintNames()
}
Output:

Jim
Bob
Tom
Sue

func SayGoodbye

func SayGoodbye()

SayGoodbye 打印两行字符串

Example

检测多行输出

package main

import (
	"github.com/stevenlee87/go-daily-lib/expert_programming/chapter7/7.1_quick_start/gotest"
)

func main() {
	gotest.SayGoodbye()
}
Output:

Hello,
goodbye

func SayHello

func SayHello()

SayHello 打印一行字符串

Example

检测单行输出

package main

import (
	"github.com/stevenlee87/go-daily-lib/expert_programming/chapter7/7.1_quick_start/gotest"
)

func main() {
	gotest.SayHello()
}
Output:

Hello World

Types

This section is empty.

Jump to

Keyboard shortcuts

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