File: operator_spec.rb

package info (click to toggle)
jruby 1.7.26-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 84,572 kB
  • sloc: ruby: 669,910; java: 253,056; xml: 35,152; ansic: 9,187; yacc: 7,267; cpp: 5,244; sh: 1,036; makefile: 345; jsp: 48; tcl: 40
file content (53 lines) | stat: -rw-r--r-- 1,811 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require File.dirname(__FILE__) + "/../spec_helper"

java_import "java_integration.fixtures.ScalaOperators"

describe "Scala operators" do
  it "are callable using symbolic names" do
    obj = ScalaOperators.new

    obj.send(:"+").should == "$plus"
    obj.send(:"-").should == "$minus"
    obj.send(:":").should == "$colon"
    obj.send(:"/").should == "$div"
    obj.send(:"=").should == "$eq"
    obj.send(:"<").should == "$less"
    obj.send(:">").should == "$greater"
    obj.send(:"\\").should == "$bslash"
    obj.send(:"#").should == "$hash"
    obj.send(:"*").should == "$times"
    obj.send(:"!").should == "$bang"
    obj.send(:"@").should == "$at"
    obj.send(:"%").should == "$percent"
    obj.send(:"^").should == "$up"
    obj.send(:"&").should == "$amp"
    obj.send(:"~").should == "$tilde"
    obj.send(:"?").should == "$qmark"
    obj.send(:"|").should == "$bar"
    obj.send(:"+=").should == "$plus$eq"
  end

  it "are callable using original names" do
    obj = ScalaOperators.new
    
    obj.send(:"$plus").should == "$plus"
    obj.send(:"$minus").should == "$minus"
    obj.send(:"$colon").should == "$colon"
    obj.send(:"$div").should == "$div"
    obj.send(:"$eq").should == "$eq"
    obj.send(:"$less").should == "$less"
    obj.send(:"$greater").should == "$greater"
    obj.send(:"$bslash").should == "$bslash"
    obj.send(:"$hash").should == "$hash"
    obj.send(:"$times").should == "$times"
    obj.send(:"$bang").should == "$bang"
    obj.send(:"$at").should == "$at"
    obj.send(:"$percent").should == "$percent"
    obj.send(:"$up").should == "$up"
    obj.send(:"$amp").should == "$amp"
    obj.send(:"$tilde").should == "$tilde"
    obj.send(:"$qmark").should == "$qmark"
    obj.send(:"$bar").should == "$bar"
    obj.send(:"$plus$eq").should == "$plus$eq"
  end
end