CodeSampleX

Sample

golang.org/x/text v0.16.0: cases.Title

Verified sample for golang golang.org/x/text v0.16.0: cases.Title. The contract ran on go 1.26 · linux debian/x64 · docker and passed.

sha256:fb171054de96b93ee335d67209739f7527816f4d7c49b19c4d3d3bf1d0073788

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux 24 · ubuntu · glibc 2.39 x64 go

Verification-run environments

Environment Contract Stages Run
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-15

Case

HOW
Goal
verify golang.org/x/text/cases.Title in pkg:golang/golang.org/x/text@v0.16.0
Packages
Symbols
  • golang.org/x/text/cases.Title
Created
2026-09-15T00:51:37Z

Contract

  1. cases.Title with language.English converts lower case words to title case
  2. cases.Title with language.English lowers uppercase characters not at word start by default
  3. cases.Title with cases.NoLower preserves existing uppercase characters not at word start
  4. cases.Title with language.Dutch capitalizes ij digraph at word start as IJ
  5. cases.Title with language.Und returns empty string for empty input
  6. cases.Title Bytes method transforms byte slice to title case

Files

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • main.go
  • spec.json
  • test/contract.go

Download the source artifact (tar.gz)

Source

PROMPT.md
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 golang.org/x/text/cases.Title in pkg:golang/golang.org/x/text@v0.16.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/golang.org/x/text@v0.16.0
Demonstrate these symbols/APIs:
  - golang.org/x/text/cases.Title

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.
csx.json
{"case":{"caseId":"case:sha256:7a9ee9304bca8f7c6a819a73d3d24483e67130c7440bf91dbaa679cc1143d6a6","contract":["cases.Title with language.English converts lower case words to title case","cases.Title with language.English lowers uppercase characters not at word start by default","cases.Title with cases.NoLower preserves existing uppercase characters not at word start","cases.Title with language.Dutch capitalizes ij digraph at word start as IJ","cases.Title with language.Und returns empty string for empty input","cases.Title Bytes method transforms byte slice to title case"],"goal":"verify golang.org/x/text/cases.Title in pkg:golang/golang.org/x/text@v0.16.0","kind":"HOW","packages":["pkg:golang/golang.org/x/text@v0.16.0"],"schemaVersion":1,"symbols":["golang.org/x/text/cases.Title"]},"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/golang.org/x/text@v0.16.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/text@v0.16.0","symbols":["golang.org/x/text/cases.Title"],"verifierAdapter":"golang@1"}
go.mod
module example.com/sample

go 1.23

require golang.org/x/text v0.16.0
go.sum
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
main.go
package main

import (
	"fmt"

	"golang.org/x/text/cases"
	"golang.org/x/text/language"
)

func main() {
	enTitle := cases.Title(language.English)
	fmt.Println(enTitle.String("hello world"))

	dutchTitle := cases.Title(language.Dutch)
	fmt.Println(dutchTitle.String("ijsland"))

	noLowerTitle := cases.Title(language.English, cases.NoLower)
	fmt.Println(noLowerTitle.String("iPad"))
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify golang.org/x/text/cases.Title in pkg:golang/golang.org/x/text@v0.16.0",
  "kind": "HOW",
  "packages": [
    "pkg:golang/golang.org/x/text@v0.16.0"
  ],
  "symbols": [
    "golang.org/x/text/cases.Title"
  ]
}
test/contract.go
package main

import (
	"bytes"
	"fmt"
	"os"

	"golang.org/x/text/cases"
	"golang.org/x/text/language"
)

func main() {
	// 1. cases.Title with language.English converts lower case words to title case
	got1 := cases.Title(language.English).String("the quick brown fox")
	expected1 := "The Quick Brown Fox"
	if got1 != expected1 {
		fmt.Fprintf(os.Stderr, "assertion 1 failed: expected %q, got %q\n", expected1, got1)
		os.Exit(1)
	}

	// 2. cases.Title with language.English lowers uppercase characters not at word start by default
	got2 := cases.Title(language.English).String("HELLO WORLD")
	expected2 := "Hello World"
	if got2 != expected2 {
		fmt.Fprintf(os.Stderr, "assertion 2 failed: expected %q, got %q\n", expected2, got2)
		os.Exit(1)
	}

	// 3. cases.Title with cases.NoLower preserves existing uppercase characters not at word start
	got3 := cases.Title(language.English, cases.NoLower).String("HELLO WORLD")
	expected3 := "HELLO WORLD"
	if got3 != expected3 {
		fmt.Fprintf(os.Stderr, "assertion 3 failed: expected %q, got %q\n", expected3, got3)
		os.Exit(1)
	}

	// 4. cases.Title with language.Dutch capitalizes ij digraph at word start as IJ
	got4 := cases.Title(language.Dutch).String("ijsland")
	expected4 := "IJsland"
	if got4 != expected4 {
		fmt.Fprintf(os.Stderr, "assertion 4 failed: expected %q, got %q\n", expected4, got4)
		os.Exit(1)
	}

	// 5. cases.Title with language.Und returns empty string for empty input
	got5 := cases.Title(language.Und).String("")
	expected5 := ""
	if got5 != expected5 {
		fmt.Fprintf(os.Stderr, "assertion 5 failed: expected %q, got %q\n", expected5, got5)
		os.Exit(1)
	}

	// 6. cases.Title Bytes method transforms byte slice to title case
	got6 := cases.Title(language.Und).Bytes([]byte("golang"))
	expected6 := []byte("Golang")
	if !bytes.Equal(got6, expected6) {
		fmt.Fprintf(os.Stderr, "assertion 6 failed: expected %q, got %q\n", expected6, got6)
		os.Exit(1)
	}

	fmt.Println("All contract assertions passed.")
}

Origin Seeder

anonymous