Skip to content

Commit 29fee7f

Browse files
Omar Qureshiclaude
andcommitted
docs(ruby): explain the magic values in the testInterfaces assertions
Multiply implements IFriendly, IFriendlier and IRandomNumberGenerator at once; each asserted value is a canary proving dispatch reached the right interface's implementation. The 89 is Multiply's hardcoded fake next() — not arithmetic on the operands. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f1ffc9f commit 29fee7f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/@jsii/ruby-runtime-test/spec/compliance/interfaces_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
add = JsiiCalc::Add.new(Scope::JsiiCalcLib::Number.new(10), Scope::JsiiCalcLib::Number.new(20))
2727
expect(add.hello).to eq("Hello, I am a binary operation. What's your name?")
2828

29+
# Multiply implements three interfaces at once — hello from IFriendly
30+
# (via BinaryOperation), goodbye from IFriendlier, next from
31+
# IRandomNumberGenerator — so each value below is a canary proving the
32+
# member dispatched to the right interface's implementation. The 89 is
33+
# not arithmetic: it's Multiply's hardcoded, deliberately fake "random
34+
# number generator" (calculator.ts: `public next() { return 89; }`).
2935
multiply = JsiiCalc::Multiply.new(Scope::JsiiCalcLib::Number.new(10), Scope::JsiiCalcLib::Number.new(30))
3036
expect(multiply.hello).to eq("Hello, I am a binary operation. What's your name?")
3137
expect(multiply.goodbye).to eq('Goodbye from Multiply!')

0 commit comments

Comments
 (0)