示例
Calculate unambiguous string abbreviations with Abbrev.abbrev without collision loss on duplicate words, key type drift on symbols, or mispredicting prefix filter targets
sha256:eaa5430df6f5894a5cb09fe617954babd1ca17f4595fc37a749581cee88c63aa
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Calculate unambiguous string abbreviations with Abbrev.abbrev without collision loss on duplicate words, key type drift on symbols, or mispredicting prefix filter targets HOW
- 包
- abbrev 0.1.2
- 环境
- ruby
- 创建时间
- 2026-08-16T09:10:55Z
契约
- assert Abbrev.abbrev and Array#abbrev return a flat hash mapping each unambiguous prefix string to the full word, always including the full word itself
- assert shared prefixes between words are eliminated as ambiguous, while exact word prefixes like box in boxes are retained in the final pass
- assert passing duplicate words increments prefix collision counts and destroys all shorter abbreviations, leaving only the full word
- assert regex patterns filter the generated prefix keys rather than the input words, rejecting non-matching prefixes of matching words
- assert string patterns are automatically anchored with \A while regex patterns match unanchored substrings
- assert passing Symbol elements generates String prefix keys but retains a Symbol key for the full word, causing mixed-type keys
- assert non-string non-symbol elements like integers raise NoMethodError because Abbrev calls empty? without coercion
- assert require 'abbrev' monkeypatches only Array#abbrev, while Enumerable#abbrev and Set#abbrev remain undefined
文件
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- test/contract.rb
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9