Beispiel
github.com/onsi/ginkgo/v2 v2.13.2: v2
Verifiziertes Beispiel für golang github.com/onsi/ginkgo/v2 v2.13.2: v2. Der Vertrag lief auf go 1.26 · linux alpine/x64 · docker und bestand.
sha256:dd2891faa240e4d9c238c55e744c296eb4645d4f5257eb862da4ccea5f7e8ce2
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 2
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 go
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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-26 |
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-09-07 |
Fall
HOW- Ziel
- verify github.com/onsi/ginkgo/v2 in pkg:golang/github.com/onsi/ginkgo/v2@v2.13.2
- Symbole
-
- github.com/onsi/ginkgo/v2
- Erstellt
- 2026-08-26T11:43:50Z
Contract
- Describe and Context organize specs into hierarchical test suites with It defining runnable nodes
- BeforeEach and AfterEach execute setup and teardown lifecycle hooks surrounding each specification
- DeferCleanup registers cleanup closures within spec execution that run during spec teardown
- By annotates execution steps and GinkgoWriter records contextual diagnostic messages
- RunSpecs runs the registered Ginkgo suite and returns true when all specs succeed
- Fail marks the active spec as failed and causes RunSpecs to return false and invoke testingT.Fail
Dateien
- PROMPT.md
- csx.json
- go.mod
- go.sum
- sample.go
- spec.json
- test/contract.go
Quelltext
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/onsi/ginkgo/v2 in pkg:golang/github.com/onsi/ginkgo/v2@v2.13.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/onsi/ginkgo/v2@v2.13.2
Demonstrate these symbols/APIs:
- github.com/onsi/ginkgo/v2
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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.
{"case":{"caseId":"case:sha256:61c431856303fa64c8e19c0a717de362c203d5963dca12e822384920291de14a","contract":["Describe and Context organize specs into hierarchical test suites with It defining runnable nodes","BeforeEach and AfterEach execute setup and teardown lifecycle hooks surrounding each specification","DeferCleanup registers cleanup closures within spec execution that run during spec teardown","By annotates execution steps and GinkgoWriter records contextual diagnostic messages","RunSpecs runs the registered Ginkgo suite and returns true when all specs succeed","Fail marks the active spec as failed and causes RunSpecs to return false and invoke testingT.Fail"],"goal":"verify github.com/onsi/ginkgo/v2 in pkg:golang/github.com/onsi/ginkgo/v2@v2.13.2","kind":"HOW","packages":["pkg:golang/github.com/onsi/ginkgo/v2@v2.13.2"],"schemaVersion":1,"symbols":["github.com/onsi/ginkgo/v2"]},"contractCommand":["go","run","./test"],"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/onsi/ginkgo/v2@v2.13.2"],"schemaVersion":1,"subject":"pkg:golang/github.com/onsi/ginkgo/v2@v2.13.2","symbols":["github.com/onsi/ginkgo/v2"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require github.com/onsi/ginkgo/v2 v2.13.2
require (
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/tools v0.14.0 // indirect
)
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/onsi/ginkgo/v2 v2.13.2 h1:Bi2gGVkfn6gQcjNjZJVO8Gf0FHzMPf2phUei9tejVMs=
github.com/onsi/ginkgo/v2 v2.13.2/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM=
github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg=
github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
package sample
import (
"errors"
"fmt"
"sync"
)
// TaskStatus represents the current state of a task.
type TaskStatus string
const (
// StatusPending indicates the task is queued.
StatusPending TaskStatus = "PENDING"
// StatusRunning indicates the task is currently executing.
StatusRunning TaskStatus = "RUNNING"
// StatusCompleted indicates the task has finished successfully.
StatusCompleted TaskStatus = "COMPLETED"
// StatusFailed indicates the task execution encountered an error.
StatusFailed TaskStatus = "FAILED"
)
// Task represents an item in the task queue.
type Task struct {
ID string
Status TaskStatus
Data string
}
// TaskManager manages registration and lifecycle of tasks.
type TaskManager struct {
mu sync.Mutex
tasks map[string]*Task
}
// NewTaskManager creates a new initialized TaskManager instance.
func NewTaskManager() *TaskManager {
return &TaskManager{
tasks: make(map[string]*Task),
}
}
// AddTask adds a pending task to the manager.
func (m *TaskManager) AddTask(id, data string) error {
m.mu.Lock()
defer m.mu.Unlock()
if id == "" {
return errors.New("task id cannot be empty")
}
if _, exists := m.tasks[id]; exists {
return fmt.Errorf("task %q already exists", id)
}
m.tasks[id] = &Task{
ID: id,
Status: StatusPending,
Data: data,
}
return nil
}
// RunTask transitions a pending task to running and then completed.
func (m *TaskManager) RunTask(id string) (*Task, error) {
m.mu.Lock()
defer m.mu.Unlock()
task, exists := m.tasks[id]
if !exists {
return nil, fmt.Errorf("task %q not found", id)
}
task.Status = StatusRunning
task.Status = StatusCompleted
return task, nil
}
// GetTask retrieves a task by its ID.
func (m *TaskManager) GetTask(id string) (*Task, error) {
m.mu.Lock()
defer m.mu.Unlock()
task, exists := m.tasks[id]
if !exists {
return nil, fmt.Errorf("task %q not found", id)
}
return task, nil
}
// Reset clears all tasks from the manager.
func (m *TaskManager) Reset() {
m.mu.Lock()
defer m.mu.Unlock()
m.tasks = make(map[string]*Task)
}
{
"schemaVersion": 1,
"goal": "verify github.com/onsi/ginkgo/v2 in pkg:golang/github.com/onsi/ginkgo/v2@v2.13.2",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/onsi/ginkgo/v2@v2.13.2"
],
"symbols": [
"github.com/onsi/ginkgo/v2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
package main
import (
"fmt"
"os"
"os/exec"
"github.com/onsi/ginkgo/v2"
"sample"
)
type mockTestingT struct {
failed bool
}
func (m *mockTestingT) Fail() {
m.failed = true
}
func runFailingSubprocess() {
var _ = ginkgo.Describe("Failing Suite Specification", func() {
ginkgo.It("invokes Fail explicitly to verify failure handling", func() {
ginkgo.Fail("intentional assertion failure for contract verification")
})
})
t := &mockTestingT{}
suiteConfig, reporterConfig := ginkgo.GinkgoConfiguration()
reporterConfig.NoColor = true
reporterConfig.Succinct = true
passed := ginkgo.RunSpecs(t, "Failing Ginkgo Suite", suiteConfig, reporterConfig)
if !passed && t.failed {
// Expected outcome: RunSpecs returns false and t.Fail() was called
os.Exit(42)
}
os.Exit(1)
}
func main() {
// Subprocess mode for testing Fail behavior in isolation
if len(os.Args) > 1 && os.Args[1] == "--verify-fail" {
runFailingSubprocess()
return
}
var mgr *sample.TaskManager
var lifecycleEvents []string
var cleanupRan bool
var stepsRecorded []string
// Assertion 1 & 2 & 3 & 4: Hierarchical blocks, hooks, DeferCleanup, By, and GinkgoWriter
ginkgo.Describe("TaskManager BDD Suite", func() {
ginkgo.BeforeEach(func() {
mgr = sample.NewTaskManager()
lifecycleEvents = append(lifecycleEvents, "beforeEach")
})
ginkgo.AfterEach(func() {
lifecycleEvents = append(lifecycleEvents, "afterEach")
})
ginkgo.Context("when adding and processing tasks", func() {
ginkgo.It("executes the spec, records By steps, logs to GinkgoWriter, and runs DeferCleanup", func() {
ginkgo.By("Step 1: Add a task to manager")
stepsRecorded = append(stepsRecorded, "add_task")
err := mgr.AddTask("task-alpha", "payload-data")
if err != nil {
ginkgo.Fail(fmt.Sprintf("unexpected error adding task: %v", err))
}
ginkgo.By("Step 2: Register DeferCleanup handler")
stepsRecorded = append(stepsRecorded, "defer_cleanup")
ginkgo.DeferCleanup(func() {
cleanupRan = true
mgr.Reset()
})
ginkgo.By("Step 3: Run task and verify status transition")
stepsRecorded = append(stepsRecorded, "run_task")
task, err := mgr.RunTask("task-alpha")
if err != nil {
ginkgo.Fail(fmt.Sprintf("unexpected error running task: %v", err))
}
if task.Status != sample.StatusCompleted {
ginkgo.Fail(fmt.Sprintf("expected status COMPLETED, got %v", task.Status))
}
fmt.Fprintln(ginkgo.GinkgoWriter, "Task processed successfully in GinkgoWriter diagnostic stream")
lifecycleEvents = append(lifecycleEvents, "it")
})
})
})
// Assertion 5: RunSpecs runs registered Ginkgo suite and returns true on success
t := &mockTestingT{}
suiteConfig, reporterConfig := ginkgo.GinkgoConfiguration()
reporterConfig.NoColor = true
reporterConfig.Succinct = true
passed := ginkgo.RunSpecs(t, "Ginkgo Contract Suite", suiteConfig, reporterConfig)
if !passed {
fmt.Fprintf(os.Stderr, "Assertion failed: RunSpecs expected to return true, got false\n")
os.Exit(1)
}
if t.failed {
fmt.Fprintf(os.Stderr, "Assertion failed: mockTestingT was marked failed unexpectedly\n")
os.Exit(1)
}
// Verify lifecycle ordering: BeforeEach -> It -> AfterEach
if len(lifecycleEvents) != 3 ||
lifecycleEvents[0] != "beforeEach" ||
lifecycleEvents[1] != "it" ||
lifecycleEvents[2] != "afterEach" {
fmt.Fprintf(os.Stderr, "Assertion failed: lifecycle events mismatch: %v\n", lifecycleEvents)
os.Exit(1)
}
// Verify DeferCleanup executed
if !cleanupRan {
fmt.Fprintf(os.Stderr, "Assertion failed: DeferCleanup handler did not execute\n")
os.Exit(1)
}
// Verify By steps recorded
if len(stepsRecorded) != 3 ||
stepsRecorded[0] != "add_task" ||
stepsRecorded[1] != "defer_cleanup" ||
stepsRecorded[2] != "run_task" {
fmt.Fprintf(os.Stderr, "Assertion failed: By steps mismatch: %v\n", stepsRecorded)
os.Exit(1)
}
// Assertion 6: Verify Fail causes RunSpecs to return false and call testingT.Fail in subprocess
// Note: when running "go run ./test", os.Args[0] is the compiled temporary test binary
cmd := exec.Command(os.Args[0], "--verify-fail")
err := cmd.Run()
if exitErr, ok := err.(*exec.ExitError); ok {
if exitErr.ExitCode() != 42 {
fmt.Fprintf(os.Stderr, "Assertion failed: expected subprocess exit code 42, got %d\n", exitErr.ExitCode())
os.Exit(1)
}
} else if err != nil {
fmt.Fprintf(os.Stderr, "Assertion failed: unexpected error running subprocess: %v\n", err)
os.Exit(1)
} else {
fmt.Fprintf(os.Stderr, "Assertion failed: expected subprocess to fail, but exited 0\n")
os.Exit(1)
}
fmt.Println("All Ginkgo v2 contract assertions passed.")
}
Ursprungs-Seeder
anonym