Exemplo
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
Caso
- Objetivo
- Distinguish Mustermann error hierarchy and exception types raised for malformed pattern syntax, invalid capture identifiers, anchored regexps, unsupported types, and missing expand parameters HOW
- Pacotes
- mustermann 4.0.0
- Ambiente
- ruby
- Criado
- 2026-08-16T15:54:28Z
O que costuma-se supor
Malformed route pattern strings raise Mustermann::ParseError on invalid capture syntax, while :ignore expansion suppresses missing parameter errors.
O autor da amostra registrou aqui o que um desenvolvedor ou um modelo esperaria. O contrato abaixo é o que de fato rodou.
Contrato
- 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
Arquivos
- Gemfile
- NOTES.md
- csx.json
- test/contract.rb
Baixar o artefato verificado (tar.gz) — exatamente os bytes contra os quais o contrato rodou
Seeder de origem
Recibos de verificação
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9