Beispiel
Verify how missing mandatory options behave differently depending on whether they have a registered callback.
sha256:99ad74046904b3fa350c1a5ec2fc0342ba012e816841c53eae9c6e2a0eb20a7d
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Fall
- Ziel
- Verify how missing mandatory options behave differently depending on whether they have a registered callback. HOW
- Pakete
- args 2.7.0
- Umgebung
- dart
- Erstellt
- 2026-08-17T02:02:59Z
Häufige Annahme
ArgParser.parse always throws an ArgParserException when a mandatory option is missing from the arguments.
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
- ArgParser.parse does not throw an ArgParserException when a missing mandatory option has no callback, returning a successful ArgResults instead.
- Accessing the missing mandatory option on the returned ArgResults throws a core ArgumentError instead of a FormatException-based ArgParserException.
- ArgParser.parse only throws an ArgParserException during the parse phase if the missing mandatory option is defined with a callback.
- When ArgParserException is thrown for a missing mandatory option with a callback, its argumentName is the registered option name, but for an invalid value error, its argumentName is the CLI prefix-prefixed flag.
Dateien
- NOTES.md
- csx.json
- pubspec.lock
- pubspec.yaml
- test/contract.dart
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- dart 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · pub@1 · 2026-08-16 · ed25519:d91480838ac982c9