github.com/anycable/anycable-go@v1.5.1/mrb/mrb_test.go (about) 1 //go:build (darwin && mrb) || (linux && mrb) 2 // +build darwin,mrb linux,mrb 3 4 package mrb 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestLoadString(t *testing.T) { 13 engine := NewEngine() 14 15 engine.LoadString( 16 ` 17 module Example 18 def self.add(a, b) 19 a + b 20 end 21 end 22 `, 23 ) 24 25 result, err := engine.Eval("Example.add(20, 22)") 26 27 assert.Nil(t, err) 28 assert.Equal(t, 42, result.Fixnum()) 29 }