Sha256: 3c7f674eb27d69fef211cb40d34212c77d45ccb74802134d09a87d0fae3001e1
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 KB
Contents
#! /usr/bin/env rspec require 'spec_helper' module MCollective module Matcher describe 'scanner' do it "should identify a '(' token" do scanner = Scanner.new("(") token = scanner.get_token token.should == ["(", "("] end it "should identify a ')' token" do scanner = Scanner.new(")") token = scanner.get_token token.should == [")", ")"] end it "should identify a 'and' token" do scanner = Scanner.new("and ") token = scanner.get_token token.should == ["and", "and"] end it "should identify a 'or' token" do scanner = Scanner.new("or ") token = scanner.get_token token.should == ["or", "or"] end it "should identify a 'not' token" do scanner = Scanner.new("not ") token = scanner.get_token token.should == ["not", "not"] end it "should identify a '!' token" do scanner = Scanner.new("!") token = scanner.get_token token.should == ["not", "not"] end it "should identify a fact statement token" do scanner = Scanner.new("foo=bar") token = scanner.get_token token.should == ["statement", "foo=bar"] end it "should identify a fact statement token" do scanner = Scanner.new("foo=bar") token = scanner.get_token token.should == ["statement", "foo=bar"] end it "should identify a class statement token" do scanner = Scanner.new("/class/") token = scanner.get_token token.should == ["statement", "/class/"] end it "should fail if expression terminates with 'and'" do scanner = Scanner.new("and") expect { token = scanner.get_token }.to raise_error("Class name cannot be 'and', 'or', 'not'. Found 'and'") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mcollective-client-2.0.0 | spec/unit/matcher/scanner_spec.rb |
mcollective-client-1.3.3 | spec/unit/matcher/scanner_spec.rb |