summaryrefslogtreecommitdiff
path: root/spec/ruby/library/getoptlong/terminated_spec.rb
blob: 01a8feddeade898fd2ac78afb3ce5d37f734865d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require_relative '../../spec_helper'
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