Sha256: cbac3750e01e4f5235aef6f0dfd571d8bfca915e179460c2e97eafa874e9b758

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 KB

Contents

# Code Generated by ZenTest v. 3.11.1

require 'test/unit' unless defined? $ZENTEST and $ZENTEST

$:.unshift File.dirname(__FILE__) + "/../lib" 
require 'relisp'

module TestRelisp
  class TestElispSlave < Test::Unit::TestCase
    def setup
      @emacs = Relisp::ElispSlave.new
    end

    def test_debugging
      @emacs.debugging
      assert @emacs.debug
      @emacs.debugging
      assert ! @emacs.debug      
    end

    def test_do
      assert_equal 3, @emacs.do("(+ 1 2)")
    end
  end
end

# module TestRelisp
#   class TestRubySlave < Test::Unit::TestCase
#   end
# end

module TestRelisp
  class TestSlave < Test::Unit::TestCase
    def setup
      @emacs = Relisp::ElispSlave.new
    end

    def test_elisp_eval
      # this is really tested in plenty of other places
      assert_equal 3, @emacs.elisp_eval("(+ 1 2)")
    end

    def test_elisp_execute
      @emacs.elisp_execute("(setq blah 17)")
      assert_equal 17, @emacs.elisp_eval(:blah)
      assert_raise Relisp::ElispError do 
        puts @emacs.elisp_execute("(relisp-nonsense-function 2)")
      end

    end

    def test_get_permanent_variable
      @emacs.elisp_eval("(setq foo 3)")
      new_foo = @emacs.get_permanent_variable :foo
      assert_equal @emacs.elisp_eval(new_foo), 3
    end

    def test_new_elisp_variable
      vars = Array.new
      size = 1000
      size.times do 
        vars << @emacs.new_elisp_variable
      end
      assert_equal size, vars.uniq.size
    end

    def test_provide
      test_array = [1, 2, 4]
      @emacs.provide(:test_array, binding)
      assert_equal test_array, @emacs.test_array
      test_array.pop
      assert_equal test_array, @emacs.test_array
    end

    def test_method_missing
      assert_equal 6, @emacs.+(1, 2, 3)
      assert_raise NameError do
        @emacs.utter_nonsense
      end
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
relisp-0.9.0 test/test_slaves.rb