Пример
Distinguish JSON.dump Marshal-compatible default options and argument dispatch from JSON.generate strict limits
sha256:4c386a5b763c3a3e2bbc668a77a917939638feb691e08cb081805758360988ae
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Кейс
- Цель
- Distinguish JSON.dump Marshal-compatible default options and argument dispatch from JSON.generate strict limits HOW
- Пакеты
- json 2.9.1
- Окружение
- ruby
- Создан
- 2026-08-17T02:43:30Z
Что обычно предполагают
JSON.dump is a direct alias for JSON.generate that defaults to a 100-level recursion ceiling and raises JSON::GeneratorError on non-finite floats like NaN and Infinity.
Автор образца записал здесь то, чего ожидал бы разработчик или модель. Контракт ниже — это то, что действительно выполнялось.
Контракт
- JSON.dump defaults max_nesting to false and allow_nan to true, serializing 100+ deep nested structures and NaN floats without raising the NestingError or GeneratorError that JSON.generate enforces
- assert JSON.dump routes a non-IO integer passed as its second argument to the nesting limit and returns a String, whereas passing an IO stream writes to the stream and returns the IO instance itself
- assert exceeding the nesting limit in JSON.dump raises ArgumentError with exceed depth limit rather than JSON::NestingError
- assert passing unsupported generator keyword arguments to JSON.dump raises ArgumentError due to strict keyword filtering
Файлы
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/dump_adapter.rb
- test/contract.rb
Скачать проверенный артефакт (tar.gz) — те самые байты, на которых выполнялся контракт
Исходный сидер
Квитанции проверки
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-17 · ed25519:d91480838ac982c9