Sha256: 7898667718b1e372e5b966710205a7b75bff26b128fb1be86f804c49f8c8e807
Contents?: true
Size: 953 Bytes
Versions: 11
Compression:
Stored size: 953 Bytes
Contents
#-- # Author:: Tyler Rick # Copyright:: Copyright (c) 2007 QualitySmith, Inc. # License:: Ruby License # Submit to Facets?:: Yes #++ require 'rubygems' require 'escape' # http://www.a-k-r.org/escape/ require 'extensions/symbol' unless Symbol.method_defined?(:to_proc) require 'facets/core/kernel/require_local' class String def shell_escape Escape.shell_command([self]) end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TheTest < Test::Unit::TestCase def assert_that_echo_gives_back_what_we_put_in(input) input = %q{!&'"`$0 |()<>} output = `echo -n #{input.shell_escape}` assert_equal input, output end def test_1 assert_that_echo_gives_back_what_we_put_in( %q{!&'"`$0 |()<>} ) end def test_2 assert_that_echo_gives_back_what_we_put_in( %q{'an arg that's got "quotes"} ) end end =end
Version data entries
11 entries across 11 versions & 1 rubygems