Update stdlib
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / dirname_spec.rb
1 require 'spec_helper'
2
3 describe 'dirname' do
4   it { is_expected.not_to eq(nil) }
5   it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
6   it { is_expected.to run.with_params('one', 'two').and_raise_error(Puppet::ParseError) }
7   it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError) }
8   it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError) }
9   it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError) }
10   it { is_expected.to run.with_params('/path/to/a/file.ext', []).and_raise_error(Puppet::ParseError) }
11   it { is_expected.to run.with_params('/path/to/a/file.ext').and_return('/path/to/a') }
12   it { is_expected.to run.with_params('relative_path/to/a/file.ext').and_return('relative_path/to/a') }
13
14   context 'should run with UTF8 and double byte characters' do
15     it { is_expected.to run.with_params('scheme:///√ạĺűē/竹.ext').and_return('scheme:///√ạĺűē') }
16     it { is_expected.to run.with_params('ҝẽγ:/√ạĺűē/竹.ㄘ').and_return('ҝẽγ:/√ạĺűē') }
17   end
18 end