Sha256: 8898d3ad66898cae3b2332644547498fe063f4fcf37162f08ca6d771b3387eca

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

require 'qcmd'

describe Qcmd::Parser do
  it "should parse simple commands" do
    tokens = Qcmd::Parser.parse "go"
    tokens.should eql(['go'])
  end

  it "should parse embedded strings" do
    tokens = Qcmd::Parser.parse 'go "word word"'
    tokens.should eql(['go', 'word word'])
  end

  it "should parse integers" do
    tokens = Qcmd::Parser.parse 'go "word word" 10'
    tokens.should eql(['go', 'word word', 10])
  end

  it "should parse floats" do
    tokens = Qcmd::Parser.parse 'go "word word" 10 -12.3'
    tokens.should eql(['go', 'word word', 10, -12.3])
  end

  it "should parse nested quotes" do
    tokens = Qcmd::Parser.parse 'go "word word" 10 -12.3 "life \"is good\" yeah"'
    tokens.should eql(['go', 'word word', 10, -12.3, 'life "is good" yeah'])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qcmd-0.1.7 spec/unit/parser_spec.rb
qcmd-0.1.6 spec/parser_spec.rb
qcmd-0.1.5 spec/parser_spec.rb
qcmd-0.1.4 spec/parser_spec.rb
qcmd-0.1.3 spec/parser_spec.rb