diff options
author | murphy <murphy@rubychan.de> | 2010-06-11 10:49:56 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-06-11 10:49:56 +0000 |
commit | e1fc595c0ef72537b2a01ff8591f83d4b077241e (patch) | |
tree | 981537d5d32ec989e603a976a9d00aef2762fb37 /test/executable | |
parent | 94d04c5dea0284d9ea35f558e8ed2a464f25edee (diff) | |
download | coderay-e1fc595c0ef72537b2a01ff8591f83d4b077241e.tar.gz |
Added coderay executable tests.
Diffstat (limited to 'test/executable')
-rwxr-xr-x | test/executable/suite.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/executable/suite.rb b/test/executable/suite.rb new file mode 100755 index 0000000..da84fb0 --- /dev/null +++ b/test/executable/suite.rb @@ -0,0 +1,45 @@ +require 'test/unit' +require 'pathname' + +MYDIR = File.dirname(__FILE__) + +$:.unshift 'lib' +require 'coderay' +puts "Running basic CodeRay #{CodeRay::VERSION} executable tests..." + +class TestCodeRayExecutable < Test::Unit::TestCase + + ruby = `ps -c #$$`[/\w+\Z/] + ruby = 'jruby' if ruby == 'java' + + ROOT_DIR = Pathname.new(File.dirname(__FILE__)) + '..' + '..' + EXECUTABLE = ROOT_DIR + 'bin' + 'coderay2' + EXE_COMMAND = '%s -wI%s %s'% [ + ruby, # calling Ruby process command + ROOT_DIR + 'lib', # library dir + EXECUTABLE + ] + + def coderay args + command = "#{EXE_COMMAND} #{args}" + # puts command + `#{command}` + end + + def test_simple + assert_equal '', coderay('') + end + + VERSION_PATTERN = /\ACodeRay \d\.\d\.\d\n\z/ + def test_version + assert_match(VERSION_PATTERN, coderay('--version')) + assert_match(VERSION_PATTERN, coderay('-v')) + end + + HELP_PATTERN = /Usage:/ + def test_help + assert_match(HELP_PATTERN, coderay('--help')) + assert_match(HELP_PATTERN, coderay('-h')) + end + +end
\ No newline at end of file |