Merge branch 'trunk' of ssh://src.le-moine.org:38172/gwh/rpn.rb into trunk
This commit is contained in:
commit
8e7c50fc66
1 changed files with 27 additions and 0 deletions
27
spec/core_spec.rb
Normal file
27
spec/core_spec.rb
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# coding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'test/unit'
|
||||||
|
|
||||||
|
require_relative '../lib/core'
|
||||||
|
|
||||||
|
class TestParser < Test::Unit::TestCase
|
||||||
|
def test_stack_extract
|
||||||
|
stack, args = Rpl::Core.stack_extract [{ value: 1, type: :numeric },
|
||||||
|
{ value: 2, type: :numeric }],
|
||||||
|
[:any]
|
||||||
|
assert_equal [{ value: 1, type: :numeric }],
|
||||||
|
stack
|
||||||
|
assert_equal [{ value: 2, type: :numeric }],
|
||||||
|
args
|
||||||
|
|
||||||
|
stack, args = Rpl::Core.stack_extract [{ value: 1, type: :numeric },
|
||||||
|
{ value: 2, type: :numeric }],
|
||||||
|
[:any, [:numeric]]
|
||||||
|
assert_equal [],
|
||||||
|
stack
|
||||||
|
assert_equal [{ value: 1, type: :numeric },
|
||||||
|
{ value: 2, type: :numeric }],
|
||||||
|
args
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue