stretchr/testify

require: invalid examples from doc comments as functions don't return bool

Open

#1,776 创建于 2025年8月4日

在 GitHub 查看
 (8 评论) (1 反应) (1 负责人)Go (1,704 fork)batch import
bugdocumentationgood first issue

仓库指标

Star
 (25,958 star)
PR 合并指标
 (平均合并 6天 15小时) (30 天内合并 2 个 PR)

描述

Description

The doc comments for multiple functions in the require package have code examples that are invalid. Example:

https://github.com/stretchr/testify/blob/a53be35c3b0cfcd5189cffcfd75df60ea581104c/require/require.go#L1391

The example reads:

	  if require.NoError(t, err) {
		   require.Equal(t, expectedObj, actualObj)
	  }

but the NoError() function does not return any value, so this is invalid.

There are similar invalid examples in the doc comments for NoErrorf, NotEmpty and NotEmptyf.

贡献者指南