summaryrefslogtreecommitdiff
path: root/spec/ruby/library/getoptlong/terminated_spec.rb
blob: feaf2bc09e641e286e5107b8c18c0fbdbed4afd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require File.expand_path('../../../spec_helper', __FILE__)
require 'getoptlong'

describe "GetoptLong#terminated?" do
  it "returns true if option processing has terminated" do
    argv [ "--size", "10k" ] do
      opts = GetoptLong.new(["--size", GetoptLong::REQUIRED_ARGUMENT])
      opts.terminated?.should == false

      opts.get.should == ["--size", "10k"]
      opts.terminated?.should == false

      opts.get.should == nil
      opts.terminated?.should == true
    end
  end
end