X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Ffunctions%2Fextname_spec.rb;fp=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Ffunctions%2Fextname_spec.rb;h=0a8d3caf71efbbf8d51115800128e78a996a2ea8;hb=9dd86576df2182653f8e96f51f11c917341eb4ce;hp=0000000000000000000000000000000000000000;hpb=88887aa2a8ca345d6f79fccb336a9bb9ae8443a2;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/functions/extname_spec.rb b/3rdparty/modules/stdlib/spec/functions/extname_spec.rb new file mode 100644 index 000000000..0a8d3caf7 --- /dev/null +++ b/3rdparty/modules/stdlib/spec/functions/extname_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe 'stdlib::extname' do + it { is_expected.not_to eq(nil) } + it { is_expected.to run.with_params.and_raise_error(ArgumentError, %r{'stdlib::extname' expects 1 argument, got none}) } + it { is_expected.to run.with_params('one', 'two').and_raise_error(ArgumentError, %r{'stdlib::extname' expects 1 argument, got 2}) } + it { is_expected.to run.with_params([]).and_raise_error(ArgumentError, %r{'stdlib::extname' parameter 'filename' expects a String value, got Array}) } + it { is_expected.to run.with_params('test.rb').and_return('.rb') } + it { is_expected.to run.with_params('a/b/d/test.rb').and_return('.rb') } + it { is_expected.to run.with_params('test').and_return('') } + it { is_expected.to run.with_params('.profile').and_return('') } + + context 'with UTF8 and double byte characters' do + it { is_expected.to run.with_params('file_√ạĺűē/竹.rb').and_return('.rb') } + end +end