Page MenuHomeSoftware Heritage

shell_escape_spec.rb
No OneTemporary

shell_escape_spec.rb

require 'spec_helper'
describe 'shell_escape' do
it { is_expected.not_to eq(nil) }
describe 'signature validation' do
it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
it { is_expected.to run.with_params('foo', 'bar').and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
end
describe 'stringification' do
it { is_expected.to run.with_params(10).and_return('10') }
it { is_expected.to run.with_params(false).and_return('false') }
end
describe 'escaping' do
it { is_expected.to run.with_params('foo').and_return('foo') }
it { is_expected.to run.with_params('foo bar').and_return('foo\ bar') }
it {
is_expected.to run.with_params('~`!@#$%^&*()_+-=[]\{}|;\':",./<>?')
.and_return('\~\`\!@\#\$\%\^\&\*\(\)_\+-\=\[\]\\\\\{\}\|\;\\\':\",./\<\>\?')
}
end
context 'with UTF8 and double byte characters' do
it { is_expected.to run.with_params('スペー スを含むテ キスト').and_return('\\\\\\\\ \\\\\\\\\\\\ \\ \\\\\\ト') }
it { is_expected.to run.with_params('μťƒ 8 ŧĕχť').and_return('\\μ\\ť\\ƒ\\ 8\\ \\ \\ŧ\\ĕ\\χ\\ť') }
end
end

File Metadata

Mime Type
text/x-ruby
Expires
Wed, Jun 4, 7:20 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3377337

Event Timeline