Sha256: 8f643362c2083d039551d592dbdd32b2c566d73b8dee7f0868b45f8b5e23b009
Contents?: true
Size: 1.7 KB
Versions: 3
Compression:
Stored size: 1.7 KB
Contents
require File.expand_path('../test_helper.rb', File.dirname(__FILE__)) describe RipperRubyParser::Parser do describe "#parse" do describe "for the while statement" do it "works in the single-line postfix case" do "foo while bar". must_be_parsed_as s(:while, s(:call, nil, :bar), s(:call, nil, :foo), true) end it "works in the block postfix case" do "begin; foo; end while bar". must_be_parsed_as s(:while, s(:call, nil, :bar), s(:call, nil, :foo), false) end it "handles a negative condition" do "while not foo; bar; end". must_be_parsed_as s(:while, s(:call, s(:call, nil, :foo), :!), s(:call, nil, :bar), true) end it "handles a negative condition in the postfix case" do "foo while not bar". must_be_parsed_as s(:while, s(:call, s(:call, nil, :bar), :!), s(:call, nil, :foo), true) end end describe "for the until statement" do it "handles a negative condition" do "until not foo; bar; end". must_be_parsed_as s(:until, s(:call, s(:call, nil, :foo), :!), s(:call, nil, :bar), true) end it "handles a negative condition in the postfix case" do "foo until not bar". must_be_parsed_as s(:until, s(:call, s(:call, nil, :bar), :!), s(:call, nil, :foo), true) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ripper_ruby_parser-1.1.1 | test/unit/parser_loops_test.rb |
ripper_ruby_parser-1.1.0 | test/unit/parser_loops_test.rb |
ripper_ruby_parser-1.0.0 | test/unit/parser_loops_test.rb |