Sha256: 8db9b33913921c53fc7e7dd3739239e8a115fb0c91af0a8aae6e53b5e2964b25

Contents?: true

Size: 693 Bytes

Versions: 3

Compression:

Stored size: 693 Bytes

Contents

require 'ceml'

class TestInstructions < Test::Unit::TestCase
  def pi text
    CEML.parse(:instructions, text)
  end

  def assert_bad text
    assert_raise(RuntimeError){ pi text }
  end

  def test_bad
    assert_bad "love your mother"
    assert_bad "tell jim re susan: i hate you"
    assert_bad "tell phil"
    assert_bad "ask susan re clothing"
    assert_bad "ask susan re clothing: "
  end

  def test_instructions
    assert_equal "run to the kitchen", pi('tell joe: run to the kitchen').tell([:joe]).text
    assert_equal ["favorite color?", "favorite soup?"], pi(
      "ask joe re color: favorite color?\nask joe re soup: favorite soup?"
    ).asks([:joe]).map(&:text)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ceml-0.3.0 test/test_instructions.rb
ceml-0.2.1 test/test_instructions.rb
ceml-0.2.0 test/test_instructions.rb