blob: da84fb009e56cb6c86cd5279426b6566070263a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
|