Should not rewrite the shebang of non-Ruby scripts
authorAntonio Terceiro <terceiro@softwarelivre.org>
Sat, 24 Sep 2011 19:02:15 +0000 (12:02 -0700)
committerAntonio Terceiro <terceiro@softwarelivre.org>
Sat, 24 Sep 2011 19:02:15 +0000 (12:02 -0700)
test/sample/rewrite_shebangs/usr/bin/shell-script [new file with mode: 0644]
test/unit/dh_ruby_test.rb

diff --git a/test/sample/rewrite_shebangs/usr/bin/shell-script b/test/sample/rewrite_shebangs/usr/bin/shell-script
new file mode 100644 (file)
index 0000000..c070e3d
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+echo "Hello, world!"
index 0d0afdb..99ad3ff 100644 (file)
@@ -153,6 +153,10 @@ class DhRubyTest < Gem2DebTestCase
       assert_match %r{/usr/bin/env ruby}, lines[0]
       assert_match /puts/, lines[1]
     end
+    should 'not rewrite shebangs non-Ruby scripts' do
+      lines = File.readlines(self.class.tmpdir + '/rewrite_shebangs/usr/bin/shell-script')
+      assert_match %r{/bin/sh}, lines[0]
+    end
     should 'leave programs with correct permissions after rewriting shebangs' do
       assert_equal '100755', '%o' % File.stat(self.class.tmpdir + '/rewrite_shebangs/usr/bin/no-shebang').mode
     end