Sha256: 3d7456da6fc7b170fe53a66bc11e5c7b6400eef9f355a132ea18b0e5bdaaaad4
Contents?: true
Size: 889 Bytes
Versions: 2
Compression:
Stored size: 889 Bytes
Contents
require_relative '../lib/rationalist' require 'minitest/autorun' require 'minitest/expectations' describe 'dash' do it '-' do Rationalist.parse(['-n', '-']).must_equal({ n: '-', _: [] }) Rationalist.parse(['-']).must_equal({ _: ['-'] }) Rationalist.parse(['-f-']).must_equal({ f: '-', _: [] }) Rationalist.parse(['-b', '-'], boolean: 'b').must_equal({ b: true, _: ['-'] }) Rationalist.parse(['-s', '-'], string: 's').must_equal({ s: '-', _: [] }) end it '-a -- b' do Rationalist.parse(['-a', '--', 'b']).must_equal({ a: true, _: ['b'] }) Rationalist.parse(['--a', '--', 'b']).must_equal({ a: true, _: ['b'] }) end it 'move arguments after the -- into their own `--` array' do Rationalist.parse(['--name', 'John', 'before', '--', 'after'], { :'--' => true }).must_equal( { name: 'John', _: ['before'], :'--' => ['after'] } ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rationalist-2.0.1 | spec/dash_spec.rb |
rationalist-2.0.0 | spec/dash_spec.rb |