CodeSampleX

Ejemplo

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

Muestra verificada para golang golang.org/x/text v0.16.0: cases.NoLower. El contrato se ejecutó en go 1.26 · linux debian/x64 · docker y pasó.

sha256:f71b174d0d2d444a497e578bc65651b356ebd5bb27118894afa388fc007db79a

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
1
Claves de firma que lo compilaron
1
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 go

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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

Caso

HOW
Objetivo
verify golang.org/x/text/cases.NoLower in pkg:golang/golang.org/x/text@v0.16.0
Paquetes
Símbolos
  • golang.org/x/text/cases.NoLower
Creado
2026-09-15T02:24:10Z

Contrato

  1. Title Caser with NoLower preserves uppercase characters in words
  2. Title Caser without NoLower lowers non-initial uppercase characters
  3. Title Caser with NoLower preserves all-caps acronyms
  4. Title Caser with NoLower capitalizes initial lowercase letters
  5. Title Caser with NoLower transforms byte slices correctly
  6. Title Caser with NoLower respects language-specific casing rules
  7. Title Caser with NoLower handles empty string input
  8. Title Caser with NoLower handles mixed punctuation and whitespace

Archivos

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

Descargar el artefacto de código fuente (tar.gz)

Código fuente

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.NoLower 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.NoLower

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:7e2c24680435d51380b748e3f0f27b1ea32afcceeb91ac1f7735f7e93e6f4246","contract":["Title Caser with NoLower preserves uppercase characters in words","Title Caser without NoLower lowers non-initial uppercase characters","Title Caser with NoLower preserves all-caps acronyms","Title Caser with NoLower capitalizes initial lowercase letters","Title Caser with NoLower transforms byte slices correctly","Title Caser with NoLower respects language-specific casing rules","Title Caser with NoLower handles empty string input","Title Caser with NoLower handles mixed punctuation and whitespace"],"goal":"verify golang.org/x/text/cases.NoLower 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.NoLower"]},"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.NoLower"],"verifierAdapter":"golang@1"}
go.mod
module example.com/sample

go 1.26.6

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() {
	defaultTitle := cases.Title(language.English)
	noLowerTitle := cases.Title(language.English, cases.NoLower)

	input := "iPhone and iPad running iOS"
	fmt.Println("Default Title:", defaultTitle.String(input))
	fmt.Println("NoLower Title:", noLowerTitle.String(input))
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify golang.org/x/text/cases.NoLower 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.NoLower"
  ]
}
test/contract.go
package main

import (
	"bytes"
	"fmt"
	"os"

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

func main() {
	// 1. Title Caser with NoLower preserves uppercase characters in words
	titleNoLower := cases.Title(language.English, cases.NoLower)
	if got := titleNoLower.String("iPhone and iPad"); got != "IPhone And IPad" {
		fmt.Fprintf(os.Stderr, "Assertion 1 failed: expected 'IPhone And IPad', got %q\n", got)
		os.Exit(1)
	}

	// 2. Title Caser without NoLower lowers non-initial uppercase characters
	titleDefault := cases.Title(language.English)
	if got := titleDefault.String("iPhone and iPad"); got != "Iphone And Ipad" {
		fmt.Fprintf(os.Stderr, "Assertion 2 failed: expected 'Iphone And Ipad', got %q\n", got)
		os.Exit(1)
	}

	// 3. Title Caser with NoLower preserves all-caps acronyms
	if got := titleNoLower.String("NASA and ESA"); got != "NASA And ESA" {
		fmt.Fprintf(os.Stderr, "Assertion 3 failed: expected 'NASA And ESA', got %q\n", got)
		os.Exit(1)
	}

	// 4. Title Caser with NoLower capitalizes initial lowercase letters
	if got := titleNoLower.String("hello world"); got != "Hello World" {
		fmt.Fprintf(os.Stderr, "Assertion 4 failed: expected 'Hello World', got %q\n", got)
		os.Exit(1)
	}

	// 5. Title Caser with NoLower transforms byte slices correctly
	inputBytes := []byte("gRPC service")
	if got := titleNoLower.Bytes(inputBytes); !bytes.Equal(got, []byte("GRPC Service")) {
		fmt.Fprintf(os.Stderr, "Assertion 5 failed: expected 'GRPC Service', got %q\n", string(got))
		os.Exit(1)
	}

	// 6. Title Caser with NoLower respects language-specific casing rules
	dutchNoLower := cases.Title(language.Dutch, cases.NoLower)
	if got := dutchNoLower.String("ijsland and IJsselmeer"); got != "IJsland And IJsselmeer" {
		fmt.Fprintf(os.Stderr, "Assertion 6 failed: expected 'IJsland And IJsselmeer', got %q\n", got)
		os.Exit(1)
	}

	// 7. Title Caser with NoLower handles empty string input
	if got := titleNoLower.String(""); got != "" {
		fmt.Fprintf(os.Stderr, "Assertion 7 failed: expected '', got %q\n", got)
		os.Exit(1)
	}

	// 8. Title Caser with NoLower handles mixed punctuation and whitespace
	if got := titleNoLower.String("  fast-paced eCommerce  "); got != "  Fast-Paced ECommerce  " {
		fmt.Fprintf(os.Stderr, "Assertion 8 failed: expected '  Fast-Paced ECommerce  ', got %q\n", got)
		os.Exit(1)
	}

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

Seeder de origen

anónimo