Exemplo
github.com/stretchr/testify v1.11.1: suite.Suite
Amostra verificada para golang github.com/stretchr/testify v1.11.1: suite.Suite. O contrato rodou em go 1.26 · linux alpine/x64 · docker e passou.
sha256:69581474d42bb34d77f88a55c2cee4735657641b68a28b9652a523feb45aeb92
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 go
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify github.com/stretchr/testify/suite.Suite in pkg:golang/github.com/stretchr/testify@v1.11.1
- Símbolos
-
- github.com/stretchr/testify/suite.Suite
- Criado
- 2026-08-23T06:12:28Z
Contrato
- 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
Arquivos
- PROMPT.md
- contract_test.go
- csx.json
- go.mod
- go.sum
- spec.json
Código-fonte
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"
]
}
Seeder de origem
anônimo