skeem 0.2.15 → 0.2.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +17 -11
  3. data/CHANGELOG.md +5 -0
  4. data/Gemfile +2 -0
  5. data/README.md +3 -2
  6. data/Rakefile +2 -0
  7. data/appveyor.yml +3 -4
  8. data/bin/skeem +15 -15
  9. data/lib/skeem.rb +2 -0
  10. data/lib/skeem/datum_dsl.rb +12 -3
  11. data/lib/skeem/element_visitor.rb +5 -2
  12. data/lib/skeem/grammar.rb +86 -24
  13. data/lib/skeem/interpreter.rb +5 -3
  14. data/lib/skeem/parser.rb +6 -4
  15. data/lib/skeem/primitive/primitive_builder.rb +128 -115
  16. data/lib/skeem/primitive/primitive_procedure.rb +17 -20
  17. data/lib/skeem/runtime.rb +9 -5
  18. data/lib/skeem/s_expr_builder.rb +46 -104
  19. data/lib/skeem/s_expr_nodes.rb +116 -90
  20. data/lib/skeem/skeem_exception.rb +0 -0
  21. data/lib/skeem/skm_binding.rb +6 -7
  22. data/lib/skeem/skm_compound_datum.rb +8 -4
  23. data/lib/skeem/skm_element.rb +14 -12
  24. data/lib/skeem/skm_empty_list.rb +6 -4
  25. data/lib/skeem/skm_exception.rb +9 -0
  26. data/lib/skeem/skm_expression.rb +3 -1
  27. data/lib/skeem/skm_frame.rb +3 -2
  28. data/lib/skeem/skm_pair.rb +23 -18
  29. data/lib/skeem/skm_procedure_exec.rb +8 -6
  30. data/lib/skeem/skm_simple_datum.rb +13 -12
  31. data/lib/skeem/skm_unary_expression.rb +15 -17
  32. data/lib/skeem/tokenizer.rb +32 -25
  33. data/lib/skeem/version.rb +3 -1
  34. data/skeem.gemspec +6 -4
  35. data/spec/skeem/add4.skm +4 -0
  36. data/spec/skeem/datum_dsl_spec.rb +13 -12
  37. data/spec/skeem/element_visitor_spec.rb +12 -10
  38. data/spec/skeem/interpreter_spec.rb +74 -46
  39. data/spec/skeem/lambda_spec.rb +9 -7
  40. data/spec/skeem/parser_spec.rb +21 -19
  41. data/spec/skeem/primitive/primitive_builder_spec.rb +57 -48
  42. data/spec/skeem/primitive/primitive_procedure_spec.rb +15 -13
  43. data/spec/skeem/runtime_spec.rb +18 -16
  44. data/spec/skeem/s_expr_nodes_spec.rb +8 -6
  45. data/spec/skeem/skm_compound_datum_spec.rb +11 -9
  46. data/spec/skeem/skm_element_spec.rb +7 -5
  47. data/spec/skeem/skm_empty_list_spec.rb +7 -5
  48. data/spec/skeem/skm_frame_spec.rb +5 -4
  49. data/spec/skeem/skm_pair_spec.rb +4 -3
  50. data/spec/skeem/skm_procedure_exec_spec.rb +2 -0
  51. data/spec/skeem/skm_simple_datum_spec.rb +24 -22
  52. data/spec/skeem/skm_unary_expression_spec.rb +11 -9
  53. data/spec/skeem/tokenizer_spec.rb +53 -44
  54. data/spec/skeem_spec.rb +2 -0
  55. data/spec/spec_helper.rb +4 -2
  56. metadata +7 -4
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../../spec_helper' # Use the RSpec framework
2
4
 
3
5
  # Load the class under test
@@ -9,8 +11,8 @@ module Skeem
9
11
  let(:nullary) { SkmArity.new(0, 0) }
10
12
  let(:unary) { SkmArity.new(1, 1) }
11
13
  let(:binary) { SkmArity.new(2, 2) }
12
- let(:zero_or_more) {SkmArity.new(0, '*') }
13
- let(:one_or_more) {SkmArity.new(1, '*') }
14
+ let(:zero_or_more) { SkmArity.new(0, '*') }
15
+ let(:one_or_more) { SkmArity.new(1, '*') }
14
16
  let(:newline_code) do
15
17
  ->(_runtime) { "\n" }
16
18
  end
@@ -49,7 +51,7 @@ module Skeem
49
51
  end
50
52
 
51
53
  it 'should complain if third argument is not a lambda' do
52
- kode = Proc.new { puts '' }
54
+ kode = proc { puts '' }
53
55
 
54
56
  err = StandardError
55
57
  err_msg = "Primitive procedure 'newline' must be implemented with a Ruby lambda."
@@ -57,7 +59,7 @@ module Skeem
57
59
  end
58
60
 
59
61
  it 'should complain if third argument is a nullary lambda' do
60
- kode = ->() { puts '' } # Missing slot for Runtime object
62
+ kode = -> { puts '' } # Missing slot for Runtime object
61
63
 
62
64
  err = StandardError
63
65
  err_msg = "Primitive procedure 'newline' lambda takes no parameter."
@@ -68,10 +70,10 @@ module Skeem
68
70
  err = StandardError
69
71
  msg1 = "Discrepancy in primitive procedure 'cube' "
70
72
 
71
- msg2 = "between arity (0) + 1 and parameter count of lambda 2."
73
+ msg2 = 'between arity (0) + 1 and parameter count of lambda 2.'
72
74
  expect { PrimitiveProcedure.new('cube', nullary, cube) }.to raise_error(err, msg1 + msg2)
73
75
 
74
- msg2 = "between arity (2) + 1 and parameter count of lambda 2."
76
+ msg2 = 'between arity (2) + 1 and parameter count of lambda 2.'
75
77
  expect { PrimitiveProcedure.new('cube', binary, cube) }.to raise_error(err, msg1 + msg2)
76
78
 
77
79
  # Nasty; this discrepancy isn't detected
@@ -79,7 +81,7 @@ module Skeem
79
81
 
80
82
  expect { PrimitiveProcedure.new('cube', unary, cube) }.not_to raise_error
81
83
 
82
- msg2 = "between arity (1) + 2 and parameter count of lambda 2."
84
+ msg2 = 'between arity (1) + 2 and parameter count of lambda 2.'
83
85
  expect { PrimitiveProcedure.new('cube', one_or_more, cube) }.to raise_error(err, msg1 + msg2)
84
86
  end
85
87
  end # context
@@ -109,7 +111,7 @@ module Skeem
109
111
  ms2 = ' (required at least 1, got 0)'
110
112
  expect { pproc.call(rtime, []) }.to raise_error(err, ms1 + ms2)
111
113
 
112
- too_much = ['foo', 'bar']
114
+ too_much = %w[foo bar]
113
115
  err = StandardError
114
116
  ms1 = 'Wrong number of arguments for #<Procedure cube>'
115
117
  ms2 = ' (required at least 1, got 2)'
@@ -129,7 +131,7 @@ module Skeem
129
131
  ms2 = ' (required at least 2, got 1)'
130
132
  expect { pproc.call(rtime, too_few) }.to raise_error(err, ms1 + ms2)
131
133
 
132
- too_much = ['foo', 'bar', 'quux']
134
+ too_much = %w[foo bar quux]
133
135
  err = StandardError
134
136
  ms1 = 'Wrong number of arguments for #<Procedure sum>'
135
137
  ms2 = ' (required at least 2, got 3)'
@@ -146,11 +148,11 @@ module Skeem
146
148
  no_arg = []
147
149
  expect(pproc.call(rtime, no_arg)).to eq(0)
148
150
 
149
- many = [SkmString.create('foo'), SkmString.create('bar'),
150
- SkmString.create('quux')]
151
- expect( pproc.call(rtime, many)).to eq(3)
151
+ many = [SkmString.create('foo'), SkmString.create('bar'),
152
+ SkmString.create('quux')]
153
+ expect(pproc.call(rtime, many)).to eq(3)
152
154
  end
153
155
  end # context
154
156
  end # describe
155
157
  end # module
156
- end # module
158
+ end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../spec_helper' # Use the RSpec framework
2
4
  require_relative '../../lib/skeem/datum_dsl'
3
5
  require_relative '../../lib/skeem/s_expr_nodes'
@@ -8,7 +10,7 @@ require_relative '../../lib/skeem/runtime' # Load the class under test
8
10
  module Skeem
9
11
  describe Runtime do
10
12
  include DatumDSL
11
-
13
+
12
14
  let(:some_env) { SkmFrame.new }
13
15
  subject { Runtime.new(some_env) }
14
16
 
@@ -20,7 +22,7 @@ module Skeem
20
22
  it 'should know the environment' do
21
23
  expect(subject.environment).to eq(some_env)
22
24
  end
23
-
25
+
24
26
  it 'should have an empty call stack' do
25
27
  expect(subject.call_stack).to be_empty
26
28
  end
@@ -42,10 +44,10 @@ module Skeem
42
44
  expect(subject.include?('dummy')).to be_truthy
43
45
  end
44
46
  end # context
45
-
47
+
46
48
  context 'Evaluation:' do
47
49
  include Primitive::PrimitiveBuilder
48
-
50
+
49
51
  # it 'should evaluate a given entry' do
50
52
  # entry = integer(3)
51
53
  # result = double('fake-procedure')
@@ -54,21 +56,21 @@ module Skeem
54
56
  # subject.define('three', entry)
55
57
  # expect(subject.evaluate('three')).to eq(3)
56
58
  # end
57
-
59
+
58
60
  it 'should evaluate a given list' do
59
61
  add_primitives(subject)
60
62
  sum = list([identifier('+'), 3, 4])
61
-
63
+
62
64
  expect(subject.evaluate_form(sum)).to eq(7)
63
65
  end
64
66
  end # context
65
-
67
+
66
68
  context 'Environment nesting:' do
67
69
  it 'should add nested environment' do
68
70
  expect(subject.depth).to eq(1)
69
71
  env_before = subject.environment
70
72
  subject.nest
71
-
73
+
72
74
  expect(subject.environment).not_to eq(env_before)
73
75
  expect(subject.environment.parent).to eq(env_before)
74
76
  expect(subject.depth).to eq(2)
@@ -79,24 +81,24 @@ module Skeem
79
81
  subject.nest
80
82
  parent_before = subject.environment.parent
81
83
  expect(subject.depth).to eq(2)
82
-
84
+
83
85
  subject.unnest
84
86
  expect(subject.environment).to eq(parent_before)
85
87
  expect(subject.depth).to eq(1)
86
88
  end
87
89
  end # context
88
-
90
+
89
91
  context 'Call stack operations:' do
90
92
  let(:sample_call) do
91
93
  pos = double('fake-position')
92
- ProcedureCall.new(pos, identifier('boolean?'), [integer(42)])
94
+ ProcedureCall.new(pos, identifier('boolean?'), [integer(42)])
93
95
  end
94
-
96
+
95
97
  it 'should push a call to the stack call' do
96
98
  expect { subject.push_call(sample_call) }.not_to raise_error
97
99
  expect(subject.call_stack.size). to eq(1)
98
100
  expect(subject.caller).to eq(sample_call)
99
-
101
+
100
102
  subject.push_call(sample_call.clone)
101
103
  expect(subject.call_stack.size). to eq(2)
102
104
  end
@@ -105,11 +107,11 @@ module Skeem
105
107
  subject.push_call(sample_call)
106
108
  expect { subject.pop_call }.not_to raise_error
107
109
  expect(subject.call_stack).to be_empty
108
-
110
+
109
111
  err = StandardError
110
112
  msg = 'Skeem call stack empty!'
111
113
  expect { subject.pop_call }.to raise_error(err, msg)
112
114
  end
113
- end # context
115
+ end # context
114
116
  end # describe
115
- end # module
117
+ end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ostruct'
2
4
  require_relative '../spec_helper' # Use the RSpec framework
3
5
  require_relative '../../lib/skeem/runtime'
@@ -6,7 +8,7 @@ require_relative '../../lib/skeem/s_expr_nodes' # Load the classes under test
6
8
 
7
9
  module Skeem
8
10
  describe ProcedureCall do
9
- let(:pos) { double('fake-position') }
11
+ let(:pos) { double('fake-position') }
10
12
  let(:operator) { SkmIdentifier.create('+') }
11
13
  let(:operands) { [1, 2, 3] }
12
14
 
@@ -14,7 +16,7 @@ module Skeem
14
16
 
15
17
  context 'Initialization:' do
16
18
  it 'should be initialized with an operator symbol and its operands' do
17
- expect{ ProcedureCall.new(pos, operator, operands) }.not_to raise_error
19
+ expect { ProcedureCall.new(pos, operator, operands) }.not_to raise_error
18
20
  end
19
21
 
20
22
  it 'should know its operator' do
@@ -45,7 +47,7 @@ module Skeem
45
47
 
46
48
  context 'Initialization:' do
47
49
  it 'should be initialized with a pos and 3 expressions' do
48
- expect{ SkmCondition.new(pos, s_test, s_consequent, s_alt) }.not_to raise_error
50
+ expect { SkmCondition.new(pos, s_test, s_consequent, s_alt) }.not_to raise_error
49
51
  end
50
52
 
51
53
  it 'should know its test' do
@@ -76,13 +78,13 @@ module Skeem
76
78
  let(:s_formals) { double('fake-formals') }
77
79
  let(:s_defs) { double('fake-definitions') }
78
80
  let(:s_sequence) { double('fake-sequence') }
79
- let(:s_body) do { defs: s_defs, sequence: s_sequence } end
81
+ let(:s_body) { { defs: s_defs, sequence: s_sequence } }
80
82
 
81
83
  subject { SkmLambdaRep.new(pos, s_formals, s_body) }
82
84
 
83
85
  context 'Initialization:' do
84
86
  it 'should be initialized with a pos and 3 expressions' do
85
- expect{ SkmLambdaRep.new(pos, s_formals, s_body) }.not_to raise_error
87
+ expect { SkmLambdaRep.new(pos, s_formals, s_body) }.not_to raise_error
86
88
  end
87
89
 
88
90
  it 'should know its formals' do
@@ -106,7 +108,7 @@ module Skeem
106
108
  # Remove "unpredictable" part of actual text
107
109
  expectation = subject.inspect.gsub(/@object_id=[0-9a-z]+, /, '')
108
110
  expect(expectation).to eq(txt1 + txt2 + txt3)
109
- end
111
+ end
110
112
  end # context
111
113
  end # describe
112
114
  end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../spec_helper' # Use the RSpec framework
2
4
  require_relative '../../lib/skeem/datum_dsl'
3
5
  require_relative '../../lib/skeem/skm_compound_datum' # Load the classes under test
@@ -12,7 +14,7 @@ module Skeem
12
14
 
13
15
  context 'Initialization:' do
14
16
  it 'should be initialized with its members' do
15
- expect{ SkmCompoundDatum.new(sample_members) }.not_to raise_error
17
+ expect { SkmCompoundDatum.new(sample_members) }.not_to raise_error
16
18
  end
17
19
 
18
20
  it 'should know its members' do
@@ -28,7 +30,7 @@ module Skeem
28
30
  expect(subject).to eq(subject)
29
31
  end
30
32
 
31
- it 'should assert the equality by member values' do
33
+ it 'should assert the equality by member values' do
32
34
  # Comparison with other instances
33
35
  expect(subject).to eq(SkmCompoundDatum.new(sample_members))
34
36
  expect(subject).not_to eq(SkmCompoundDatum.new([]))
@@ -44,12 +46,12 @@ module Skeem
44
46
  expect(visitor).to receive(:visit_compound_datum).with(subject)
45
47
  expect { subject.accept(visitor) }.not_to raise_error
46
48
  end
47
-
49
+
48
50
  it 'should return its text representation' do
49
51
  txt1 = '<Skeem::SkmCompoundDatum: <Skeem::SkmInteger: 1>,'
50
52
  txt2 = '<Skeem::SkmInteger: 2>, <Skeem::SkmInteger: 3>>'
51
53
  expect(subject.inspect).to eq(txt1 + ' ' + txt2)
52
- end
54
+ end
53
55
  end # context
54
56
 
55
57
  context 'Provided runtime services:' do
@@ -78,19 +80,19 @@ module Skeem
78
80
  end
79
81
  end # context
80
82
  end # describe
81
-
83
+
82
84
  describe SkmVector do
83
85
  let(:sample_members) { [1, 2, 3] }
84
86
  subject { SkmVector.new(sample_members) }
85
87
 
86
88
  context 'Initialization:' do
87
89
  it 'should be initialized with its members' do
88
- expect{ SkmVector.new(sample_members) }.not_to raise_error
90
+ expect { SkmVector.new(sample_members) }.not_to raise_error
89
91
  end
90
-
92
+
91
93
  it 'should react positively to vector? predicate' do
92
94
  expect(subject).to be_vector
93
- end
95
+ end
94
96
  end # context
95
97
  end # describe
96
- end # module
98
+ end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../spec_helper' # Use the RSpec framework
2
4
  require_relative '../../lib/skeem/skm_element' # Load the class under test
3
5
 
@@ -35,11 +37,11 @@ module Skeem
35
37
  let(:runtime) { double('fake-runtime') }
36
38
  let(:visitor) { double('fake-visitor') }
37
39
  let(:not_implemented) { NotImplementedError }
38
-
40
+
39
41
  it 'should be equivalent to itself' do
40
42
  expect(subject).to be_eqv(subject)
41
43
  expect(subject).not_to be_eqv(subject.clone)
42
- end
44
+ end
43
45
 
44
46
  it "should ignore the 'done!' message" do
45
47
  expect { subject.done! }.not_to raise_error
@@ -52,11 +54,11 @@ module Skeem
52
54
  it "should ignore the 'unquoted!' message" do
53
55
  expect { subject.unquoted! }.not_to raise_error
54
56
  end
55
-
57
+
56
58
  it "should complain when receiving 'skm_equal?' message" do
57
59
  msg = 'Missing implementation of method Skeem::SkmElement#skm_equal?'
58
60
  expect { subject.skm_equal?('omg') }.to raise_error(NotImplementedError, msg)
59
- end
61
+ end
60
62
 
61
63
  it "should complain when receiving 'evaluate' message" do
62
64
  expect { subject.evaluate(runtime) }.to raise_error(not_implemented)
@@ -71,4 +73,4 @@ module Skeem
71
73
  end
72
74
  end # context
73
75
  end # describe
74
- end # module
76
+ end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../spec_helper' # Use the RSpec framework
2
4
  require_relative '../../lib/skeem/skm_empty_list' # Load the class under test
3
5
 
@@ -20,10 +22,10 @@ module Skeem
20
22
 
21
23
  context 'Provided services:' do
22
24
  let(:runtime) { double('fake-runtime') }
23
-
25
+
24
26
  it 'should be equivalent to itself' do
25
27
  expect(subject).to be_eqv(SkmEmptyList.instance)
26
- expect(subject).not_to be_eqv("()")
28
+ expect(subject).not_to be_eqv('()')
27
29
  end
28
30
 
29
31
  it "should return itself when receiving 'evaluate' message" do
@@ -36,14 +38,14 @@ module Skeem
36
38
 
37
39
  it "should reply to visitor's 'accept' message" do
38
40
  visitor = double('fake-visitor')
39
- expect(visitor).to receive(:visit_empty_list).with(subject)
41
+ expect(visitor).to receive(:visit_empty_list).with(subject)
40
42
  expect { subject.accept(visitor) }.not_to raise_error
41
43
  end
42
-
44
+
43
45
  it 'should return its representation upon inspection' do
44
46
  predicted = '<Skeem::SkmEmptyList: ()>'
45
47
  expect(subject.inspect).to eq(predicted)
46
48
  end
47
49
  end # context
48
50
  end # describe
49
- end # module
51
+ end # module
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../spec_helper' # Use the RSpec framework
2
- require_relative '../../lib/skeem/datum_dsl'
4
+ require_relative '../../lib/skeem/datum_dsl'
3
5
  require_relative '../../lib/skeem/skm_frame' # Load the class under test
4
6
 
5
7
  module Skeem
@@ -9,7 +11,7 @@ module Skeem
9
11
  let(:sample_env) { SkmFrame.new }
10
12
  context 'Initialization:' do
11
13
  it 'could be initialized without argument' do
12
- expect { SkmFrame.new() }.not_to raise_error
14
+ expect { SkmFrame.new }.not_to raise_error
13
15
  end
14
16
 
15
17
  it 'could be initialized with optional argument' do
@@ -114,6 +116,5 @@ module Skeem
114
116
  expect(nested.size).to eq(1)
115
117
  end
116
118
  end # context
117
-
118
119
  end # describe
119
- end # module
120
+ end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../spec_helper' # Use the RSpec framework
2
4
  require_relative '../../lib/skeem/datum_dsl'
3
5
  require_relative '../../lib/skeem/runtime'
@@ -172,7 +174,7 @@ module Skeem
172
174
 
173
175
  it 'should support the each method' do
174
176
  my_list = SkmPair.new('w', SkmPair.new('o', SkmPair.new('w', SkmEmptyList.instance)))
175
- text = ''
177
+ text = +''
176
178
  my_list.each { |ch| text << ch.upcase }
177
179
  expect(text).to eq('WOW')
178
180
  end
@@ -228,6 +230,5 @@ module Skeem
228
230
  expect(list_length_2.inspect).to eq(predicted)
229
231
  end
230
232
  end # context
231
-
232
233
  end # describe
233
- end # module
234
+ end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../spec_helper' # Use the RSpec framework
2
4
 
3
5
  require_relative '../../lib/skeem/interpreter'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ostruct'
2
4
  require_relative '../spec_helper' # Use the RSpec framework
3
5
  require_relative '../../lib/skeem/skm_simple_datum' # Load the classes under test
@@ -47,7 +49,7 @@ module Skeem
47
49
  expect(subject).to eq(subject)
48
50
  end
49
51
 
50
- it 'should assert the equality by value' do
52
+ it 'should assert the equality by value' do
51
53
  # Comparison with other instances
52
54
  expect(instance).to eq(SkmSimpleDatum.create(3))
53
55
  expect(instance).not_to eq(SkmSimpleDatum.create('foo'))
@@ -56,24 +58,24 @@ module Skeem
56
58
  expect(instance).to eq(3)
57
59
  expect(instance).not_to eq('foo')
58
60
  end
59
-
61
+
60
62
  it 'should be equivalent to itself' do
61
63
  expect(subject).to be_eqv(subject)
62
64
  end
63
-
65
+
64
66
  it 'should be equivalent by value' do
65
67
  same = SkmSimpleDatum.create(3)
66
68
  expect(instance).to be_eqv(same)
67
- end
69
+ end
68
70
 
69
71
  it 'should be Skeem equal to itself' do
70
72
  expect(subject).to be_skm_equal(subject)
71
- end
72
-
73
+ end
74
+
73
75
  it 'should be Skeem equal by value' do
74
76
  same = SkmSimpleDatum.create(3)
75
77
  expect(instance).to be_skm_equal(same)
76
- end
78
+ end
77
79
 
78
80
  it 'should be self-evaluating' do
79
81
  expect(subject.evaluate(runtime)).to be_equal(subject)
@@ -84,7 +86,7 @@ module Skeem
84
86
  end
85
87
 
86
88
  it 'should return its text representation' do
87
- expect(subject.inspect).to eq("<Skeem::SkmSimpleDatum: sample-value>")
89
+ expect(subject.inspect).to eq('<Skeem::SkmSimpleDatum: sample-value>')
88
90
  end
89
91
 
90
92
  it 'should respond to visitor' do
@@ -173,7 +175,7 @@ module Skeem
173
175
  it 'should react positively to real? predicate' do
174
176
  expect(subject).to be_real
175
177
  end
176
-
178
+
177
179
  it 'should react negatively to exact? predicate' do
178
180
  expect(subject).not_to be_exact
179
181
  end
@@ -181,11 +183,11 @@ module Skeem
181
183
  it 'should implement the eqv? predicate' do
182
184
  same = SkmReal.create(0.51)
183
185
  different = SkmReal.create(1.21)
184
-
186
+
185
187
  expect(subject).to be_eqv(subject)
186
188
  expect(subject).to be_eqv(same)
187
189
  expect(subject).not_to be_eqv(different)
188
- end
190
+ end
189
191
  end # context
190
192
  end # describe
191
193
 
@@ -213,24 +215,24 @@ module Skeem
213
215
  it 'should react positively to integer? predicate' do
214
216
  expect(subject).to be_real
215
217
  end
216
-
218
+
217
219
  it 'should react positively to exact? predicate' do
218
220
  expect(subject).to be_exact
219
221
  end
220
222
 
221
223
  it 'should implement the eqv? predicate' do
222
224
  three = SkmInteger.create(3)
223
- real_3 = SkmReal.create(3.0)
225
+ real3 = SkmReal.create(3.0)
224
226
  four = SkmInteger.create(4)
225
-
227
+
226
228
  expect(subject).to be_eqv(three)
227
- expect(subject).not_to be_eqv(real_3)
229
+ expect(subject).not_to be_eqv(real3)
228
230
  expect(subject).not_to be_eqv(four)
229
231
  end
230
232
  end # context
231
233
  end # describe
232
234
 
233
- describe SkmString do
235
+ describe SkmString do
234
236
  let(:pos) { double('fake-position') }
235
237
  let(:dummy_symbol) { double('dummy') }
236
238
  let(:sample_value) { 'Hello' }
@@ -272,28 +274,28 @@ describe SkmString do
272
274
 
273
275
  it 'could be initialized with a token, a position and a flag' do
274
276
  expect { SkmIdentifier.new(dummy_token, pos, true) }.not_to raise_error
275
- end
277
+ end
276
278
 
277
279
  it 'should know whether it is used as a variable name' do
278
280
  expect(subject.is_var_name).to eq(false)
279
-
281
+
280
282
  instance = SkmIdentifier.new(dummy_token, pos, true)
281
283
  expect(instance.is_var_name).to eq(true)
282
284
  end
283
-
285
+
284
286
  it 'should react positively to symbol? predicate' do
285
287
  expect(subject).to be_symbol
286
288
  end
287
-
289
+
288
290
  it 'should react to verbatim? predicate' do
289
291
  expect(subject).to be_verbatim
290
292
  instance = SkmIdentifier.new(dummy_token, pos, true)
291
293
  expect(instance).not_to be_verbatim
292
- end
294
+ end
293
295
 
294
296
  it 'should return its text representation' do
295
297
  expect(subject.inspect).to eq('<Skeem::SkmIdentifier: this-is-it!>')
296
298
  end
297
299
  end # context
298
300
  end # describe
299
- end # module
301
+ end # module