File: ren_spec.rb

package info (click to toggle)
ruby-raabro 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 220 kB
  • sloc: ruby: 1,682; makefile: 32
file content (43 lines) | stat: -rw-r--r-- 697 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

#
# specifying raabro
#
# Mon Sep 21 05:46:00 JST 2015
#

require 'spec_helper'


describe Raabro do

  describe '.ren' do

    it 'returns the tree coming from the wrapped parser' do

      i = Raabro::Input.new('ta')

      t = Raabro.ren('renamed', i, :nta)

      expect(t.to_a(:leaves => true)).to eq(
        [ 'renamed', 1, 0, 2, nil, :str, 'ta' ]
      )
      expect(i.offset).to eq(2)
    end
  end

  describe '.rename' do

    it 'is an alias to .ren' do

      i = Raabro::Input.new('ta')

      t = Raabro.rename('autre', i, :nta)

      expect(t.to_a(:leaves => true)).to eq(
        [ 'autre', 1, 0, 2, nil, :str, 'ta' ]
      )
      expect(i.offset).to eq(2)
    end
  end
end