testing

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package testing 提供了一组用于测试时输出日志的辅助函数。 这个包封装了标准库 fmt 包的功能,并在输出内容前添加统一的日志前缀, 使测试输出更加清晰和易于识别。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Printf

func Printf(format string, a ...interface{})

Printf 函数用于输出带有统一前缀的格式化日志信息。 该函数会在实际内容前添加 logHeader 前缀,并根据提供的格式字符串格式化输出内容。

参数:

  • format string:格式化字符串,支持所有 fmt.Printf 的格式化指令。
  • a ...interface{}:要格式化输出的参数列表。

使用示例:

testing.Printf("当前进度:%d%%\n", 50)
testing.Printf("用户:%s,年龄:%d\n", "张三", 25)

func Println

func Println(a ...interface{})

Println 函数用于输出带有统一前缀的日志信息,并在末尾自动添加换行符。 该函数会在实际内容前添加 logHeader 前缀,并使用空格分隔多个参数。

参数:

  • a ...interface{}:要输出的任意类型参数列表,支持多个参数。

使用示例:

testing.Println("测试信息")
testing.Println("值:", 100, "状态:", "成功")

Types

This section is empty.

Jump to

Keyboard shortcuts

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