Sha256: 100116a5cfd648cdc91f772a092fb5d9ae98ca47ff78b0c359a199f3196c3429

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

require "spec_helper"

class O::Parser
	public :compile, :scan
end

describe O::Parser do
	describe "#token" do
		it "tests" do
			content = <<EOF
a 1
b:
	c {d: 1}
	d 1
	e:
		f 1
EOF
			content = <<EOF
a 1
b:
	c {d: 1}
	d 1
	e:
		f 1
g 1
EOF

			parser = O::Parser.new content
			parser.scan do |token, statement|
				#pd token, statement
			end
		end
	end

	describe "#compile" do
		it "tests" do
			content = <<EOF
a:
	b 1
EOF

			content1 = <<EOF
a 1
b:
	c {d: 1}
	d 1
	e:
		f 1
g 1
EOF
		parser = O::Parser.new content
		parser.scan do |token, statement|
			#pd token, statement
		end

		parser = O::Parser.new content
		#puts parser.compile
		end


		it "has no effects to normal ruby code" do
			content = <<EOF
a 1
b do
	c {d: 1}
	d 1
	e do
		f 1
	end
end
EOF
			parser = O::Parser.new content
			parser.scan do |token, statement|
				#pd token, statement
			end

			parser = O::Parser.new content
			#puts parser.compile
		end

		it "has both yaml-style and ruby-style" do
			content = <<EOF
a 1
b: 
	c {d: 1}
	d 1
	e do
		f 1
	end
EOF
			parser = O::Parser.new content
			parser.scan do |token, statement|
				#pd token, statement
			end

			parser = O::Parser.new content
			#puts parser.compile
		end

	end

	describe ".compile" do
		it "works" do
			content = <<EOF
a:
	b 1
EOF
			right = <<EOF
a do
	b 1
end\n
EOF

			O::Parser.compile(content).should == right

		end
	end


end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
o-2.0.4 spec/o/parser_spec.rb
o-2.0.3 spec/o/parser_spec.rb
o-2.0.2 spec/o/parser_spec.rb
o-2.0.1 spec/o/parser_spec.rb
o-2.0.0 spec/o/parser_spec.rb