Commits

Kaspar Schiess  committed 6f8f5e0

A first source spec

  • Participants
  • Parent commits 2ced7db

Comments (0)

Files changed (2)

File spec/lib/par/source_spec.rb

+# Encoding: UTF-8
+require 'spec_helper'
+
+describe Par::Source do
+  include Par
+
+  describe ".source" do
+    it "constructs a source" do
+      source('foo').should be_kind_of(described_class)
+    end
+  end
+  describe "#n" do
+    let(:s) { source 'äöü' }
+    it "consumes n characters" do
+      s.n(1).should == 'ä'
+      s.n(2).should == 'öü'
+    end
+  end
+end

File spec/lib/par_spec.rb

     it "parse" do
       (s.string('foo') >> s.string('bar')).should_not == bot
     end
+    it "or not" do
+      (s.string('bar') >> s.string('bar')).should == bot
+    end
   end
 end