サンプル
Handle Set#to_set returning self on Set receivers and downcasting Set subclasses to base Set when klass is left unset
sha256:911142f7a4bef266833a736d6209fa98347340da9b948a2a186966668a37fa8d
PUBLISHED
L3_CONTRACT_PASS
MIT-0
ケース
- ゴール
- Handle Set#to_set returning self on Set receivers and downcasting Set subclasses to base Set when klass is left unset HOW
- パッケージ
- set 1.1.1
- 環境
- ruby
- 作成日
- 2026-08-16T16:50:57Z
よくある思い込み
Calling to_set on an existing Set produces a new Set instance for safe mutation, and calling to_set on a Set subclass preserves the receiver subclass.
このサンプルの作者が、ここで開発者やモデルが期待するであろうこととして記録したもの。下の契約が実際に実行されたものだ。
コントラクト
- assert Set#to_set with default arguments returns self instead of a new duplicate set, so mutating the result modifies the original set in-place
- assert calling to_set on a Set subclass with default klass downcasts the receiver to a base Set instead of retaining the subclass
- assert calling to_set with an explicit klass argument constructs an instance of the specified class
- assert calling Set#to_set with a block returns a newly allocated Set rather than returning self
- assert Enumerable#to_set with default klass converts any Enumerable into a base Set instance
ファイル
- Gemfile
- 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