Beispiel
Distinguish Mustermann error hierarchy and exception types raised for malformed pattern syntax, invalid capture identifiers, anchored regexps, unsupported types, and missing expand parameters
sha256:aaa0dba8bc057cb87c4fc9aba644a736d975024736c643655c77f03ab87944e3
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Fall
- Ziel
- Distinguish Mustermann error hierarchy and exception types raised for malformed pattern syntax, invalid capture identifiers, anchored regexps, unsupported types, and missing expand parameters HOW
- Pakete
- mustermann 4.0.0
- Umgebung
- ruby
- Erstellt
- 2026-08-16T15:54:28Z
Häufige Annahme
Malformed route pattern strings raise Mustermann::ParseError on invalid capture syntax, while :ignore expansion suppresses missing parameter errors.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- Mustermann raises Mustermann::CompileError rather than Mustermann::ParseError when a pattern contains malformed capture names such as empty captures or leading digits, while unclosed groupings raise Mustermann::ParseError and expand with :ignore still raises Mustermann::ExpandError when required keys are missing.
- assert Mustermann.new('/foo/:') and Mustermann.new('/foo/:123') raise Mustermann::CompileError instead of Mustermann::ParseError
- assert Mustermann.new('/foo/(bar') and Mustermann.new('/foo/{bar') raise Mustermann::ParseError with unexpected token messages
- assert Mustermann.new('^/foo', type: :regexp) raises Mustermann::CompileError when anchor characters are present in regular expressions
- assert Mustermann.new('/foo', type: :unsupported_custom_type) raises ArgumentError rather than Mustermann::Error
- assert pattern.expand(:ignore, {}) raises Mustermann::ExpandError when required captures are missing because :ignore only applies to extra keys
- assert pattern.expand(:invalid_behavior, id: 1) raises ArgumentError rather than Mustermann::ExpandError
- assert Mustermann::CompileError, Mustermann::ParseError, and Mustermann::ExpandError all inherit from Mustermann::Error < StandardError
Dateien
- Gemfile
- NOTES.md
- csx.json
- test/contract.rb
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9