quickdraw/compilation_equivalence_cases/guarded_block_identity.rb
Lines
0%0 of 24 covered
Branches
—0 of 0 covered
Methods
0%0 of 8 covered
- Not run
- 3-46-79-1013-182124-252731-3234-3841
- Never called
EquivalenceCases::GuardedBlockIdentity::Impostor#equal?EquivalenceCases::GuardedBlockIdentity::Impostor#brEquivalenceCases::GuardedBlockIdentity::ImpostorReceiver#view_templateEquivalenceCases::GuardedBlockIdentity::ImpostorReceiver#block_ofEquivalenceCases::GuardedBlockIdentity::Receiver#brEquivalenceCases::GuardedBlockIdentity::TrustingComponent#equal?EquivalenceCases::GuardedBlockIdentity::TrustingComponent#view_templateEquivalenceCases::GuardedBlockIdentity::TrustingComponent#block_of
| 1 | # frozen_string_literal: true | |
| 2 | ||
| 3 | 0 | module EquivalenceCases |
| 4 | 0 | module GuardedBlockIdentity |
| 5 | # Claims to be anything it's compared with. | |
| 6 | 0 | class Impostor |
| 7 | 0 | attr_reader :calls |
| 8 | ||
| 9 | 0 | def equal?(_) = true |
| 10 | 0 | def br = (@calls ||= []) << :br |
| 11 | end | |
| 12 | ||
| 13 | 0 | class ImpostorReceiver < Phlex::HTML |
| 14 | 0 | def view_template |
| 15 | 0 | h1 { "Title" } |
| 16 | 0 | impostor = Impostor.new |
| 17 | 0 | impostor.instance_exec(&block_of { br }) |
| 18 | 0 | plain impostor.calls.inspect |
| 19 | end | |
| 20 | ||
| 21 | 0 | def block_of(&block) = block |
| 22 | end | |
| 23 | ||
| 24 | 0 | class Receiver |
| 25 | 0 | attr_reader :calls |
| 26 | ||
| 27 | 0 | def br = (@calls ||= []) << :br |
| 28 | end | |
| 29 | ||
| 30 | # Claims every receiver is itself. | |
| 31 | 0 | class TrustingComponent < Phlex::HTML |
| 32 | 0 | def equal?(_) = true |
| 33 | ||
| 34 | 0 | def view_template |
| 35 | 0 | h1 { "Title" } |
| 36 | 0 | receiver = Receiver.new |
| 37 | 0 | receiver.instance_exec(&block_of { br }) |
| 38 | 0 | plain receiver.calls.inspect |
| 39 | end | |
| 40 | ||
| 41 | 0 | def block_of(&block) = block |
| 42 | end | |
| 43 | end | |
| 44 | end |