샘플
github.com/stretchr/testify v1.11.1: suite.Suite
검증된 샘플 — golang github.com/stretchr/testify v1.11.1: suite.Suite. go 1.26 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: suite.Suite implements…
sha256:69581474d42bb34d77f88a55c2cee4735657641b68a28b9652a523feb45aeb92
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 go
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-23 |
케이스
HOW- 목표
- verify github.com/stretchr/testify/suite.Suite in pkg:golang/github.com/stretchr/testify@v1.11.1
- 심벌
-
- github.com/stretchr/testify/suite.Suite
- 생성일
- 2026-08-23T06:12:28Z
컨트랙트
- suite.Suite implements suite.TestingSuite interface providing T(), SetT(), and SetS()
- suite.Run discovers and executes all exported Test methods on structs embedding suite.Suite
- suite lifecycle hooks (SetupSuite, SetupTest, BeforeTest, AfterTest, TearDownTest, TearDownSuite) execute in deterministic order
- s.Run executes hierarchical subtests with isolated test context and triggers SetupSubTest and TearDownSubTest hooks
- embedded assertion and requirement helpers (s.Equal, s.True, s.NotNil, s.Require) operate on the active testing context
파일
- PROMPT.md
- contract_test.go
- csx.json
- go.mod
- go.sum
- spec.json
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify github.com/stretchr/testify/suite.Suite in pkg:golang/github.com/stretchr/testify@v1.11.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/stretchr/testify@v1.11.1
Demonstrate these symbols/APIs:
- github.com/stretchr/testify/suite.Suite
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
package sample_test
import (
"reflect"
"testing"
"github.com/stretchr/testify/suite"
)
// LifecycleTestSuite verifies suite lifecycle hooks, execution order, and subtests
type LifecycleTestSuite struct {
suite.Suite
events []string
}
func (s *LifecycleTestSuite) SetupSuite() {
s.events = append(s.events, "SetupSuite")
}
func (s *LifecycleTestSuite) TearDownSuite() {
s.events = append(s.events, "TearDownSuite")
}
func (s *LifecycleTestSuite) SetupTest() {
s.events = append(s.events, "SetupTest")
}
func (s *LifecycleTestSuite) TearDownTest() {
s.events = append(s.events, "TearDownTest")
}
func (s *LifecycleTestSuite) BeforeTest(suiteName, testName string) {
s.events = append(s.events, "BeforeTest:"+testName)
}
func (s *LifecycleTestSuite) AfterTest(suiteName, testName string) {
s.events = append(s.events, "AfterTest:"+testName)
}
func (s *LifecycleTestSuite) SetupSubTest() {
s.events = append(s.events, "SetupSubTest")
}
func (s *LifecycleTestSuite) TearDownSubTest() {
s.events = append(s.events, "TearDownSubTest")
}
func (s *LifecycleTestSuite) HelperNonTestMethod() {
s.events = append(s.events, "HelperNonTestMethod")
}
func (s *LifecycleTestSuite) TestFirst() {
s.events = append(s.events, "TestFirst")
s.NotNil(s.T())
s.Equal("TestLifecycleTestSuite/TestFirst", s.T().Name())
}
func (s *LifecycleTestSuite) TestSecondWithSubtests() {
s.events = append(s.events, "TestSecondWithSubtests")
executedSubtest := s.Run("nested_step", func() {
s.events = append(s.events, "InsideSubtest")
s.True(true)
s.Contains(s.T().Name(), "TestSecondWithSubtests/nested_step")
})
s.True(executedSubtest)
}
func TestLifecycleTestSuite(t *testing.T) {
s := new(LifecycleTestSuite)
// Verify suite.Suite implements suite.TestingSuite
var _ suite.TestingSuite = s
suite.Run(t, s)
expectedEvents := []string{
"SetupSuite",
"SetupTest", "BeforeTest:TestFirst", "TestFirst", "AfterTest:TestFirst", "TearDownTest",
"SetupTest", "BeforeTest:TestSecondWithSubtests", "TestSecondWithSubtests", "SetupSubTest", "InsideSubtest", "TearDownSubTest", "AfterTest:TestSecondWithSubtests", "TearDownTest",
"TearDownSuite",
}
if !reflect.DeepEqual(s.events, expectedEvents) {
t.Fatalf("unexpected lifecycle event sequence:\ngot: %+v\nwant: %+v", s.events, expectedEvents)
}
}
// AssertionTestSuite verifies direct and helper assertions provided by suite.Suite
type AssertionTestSuite struct {
suite.Suite
}
func (s *AssertionTestSuite) TestDirectAssertions() {
s.Equal(42, 42)
s.NotEqual("apple", "banana")
s.True(10 > 5)
s.False(2+2 == 5)
s.Nil(nil)
s.NotNil(s.T())
s.Len([]string{"a", "b", "c"}, 3)
s.Contains("hello world", "world")
s.ElementsMatch([]int{1, 2, 3}, []int{3, 1, 2})
s.NoError(nil)
s.Empty("")
s.NotEmpty("content")
assertHelper := s.Assert()
if assertHelper == nil {
s.T().Fatal("s.Assert() returned nil")
}
assertHelper.Equal("foo", "foo")
reqHelper := s.Require()
if reqHelper == nil {
s.T().Fatal("s.Require() returned nil")
}
reqHelper.True(true)
}
func (s *AssertionTestSuite) TestSetTContextBinding() {
originalT := s.T()
s.NotNil(originalT)
customT := new(testing.T)
s.SetT(customT)
s.Equal(customT, s.T())
s.SetT(originalT)
s.Equal(originalT, s.T())
}
func TestAssertionTestSuite(t *testing.T) {
suite.Run(t, new(AssertionTestSuite))
}
{"case":{"caseId":"case:sha256:582e0efb876810ff99ac7a4f7e90a5817b4eaa924fe0c0a4b46550fe0194231f","contract":["suite.Suite implements suite.TestingSuite interface providing T(), SetT(), and SetS()","suite.Run discovers and executes all exported Test methods on structs embedding suite.Suite","suite lifecycle hooks (SetupSuite, SetupTest, BeforeTest, AfterTest, TearDownTest, TearDownSuite) execute in deterministic order","s.Run executes hierarchical subtests with isolated test context and triggers SetupSubTest and TearDownSubTest hooks","embedded assertion and requirement helpers (s.Equal, s.True, s.NotNil, s.Require) operate on the active testing context"],"goal":"verify github.com/stretchr/testify/suite.Suite in pkg:golang/github.com/stretchr/testify@v1.11.1","kind":"HOW","packages":["pkg:golang/github.com/stretchr/testify@v1.11.1"],"schemaVersion":1,"symbols":["github.com/stretchr/testify/suite.Suite"]},"contractCommand":["go","test","-v","./..."],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/stretchr/testify@v1.11.1"],"schemaVersion":1,"subject":"pkg:golang/github.com/stretchr/testify@v1.11.1","symbols":["github.com/stretchr/testify/suite.Suite"],"verifierAdapter":"golang@1"}
module sample
go 1.22
require github.com/stretchr/testify v1.11.1
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
{
"schemaVersion": 1,
"goal": "verify github.com/stretchr/testify/suite.Suite in pkg:golang/github.com/stretchr/testify@v1.11.1",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/stretchr/testify@v1.11.1"
],
"symbols": [
"github.com/stretchr/testify/suite.Suite"
]
}
오리진 시더
익명