coderay 0.7.2.176 → 0.7.4.196

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +0,0 @@
1
- require 'coderay'
2
-
3
- token_stream = CodeRay::TokenStream.new do |kind, text|
4
- puts 'kind: %s, text size: %d.' % [kind, text.size]
5
- end
6
-
7
- token_stream << [:regexp, '/\d+/'] << [:space, "\n"]
8
- #-> kind: rexpexp, text size: 5.
@@ -1,3 +0,0 @@
1
- require 'coderay'
2
-
3
- puts CodeRay.scan("puts 3 + 4, '3 + 4'", :ruby).tokens
@@ -1,82 +0,0 @@
1
- mydir = File.dirname(__FILE__)
2
- $:.unshift mydir + '/../lib/'
3
-
4
- $VERBOSE = true
5
-
6
- require 'test/unit'
7
- include Test::Unit
8
-
9
- class CodeRaySuite < TestCase
10
-
11
- def self.dir &block
12
- @dir ||= File.dirname(__FILE__)
13
- if block
14
- Dir.chdir @dir, &block
15
- end
16
- @dir
17
- end
18
-
19
- def dir &block
20
- self.class.dir(&block)
21
- end
22
-
23
- def test_ALL
24
- dir do
25
- for input in Dir["demo_*.rb"] - %w(demo_server.rb demo_stream.rb)
26
- puts "[ testing #{input}... ]"
27
- name = File.basename(input, ".rb")
28
- output = name + '.out'
29
- code = File.open(input, 'rb') { |f| break f.read }
30
-
31
- result = `ruby -wI../lib #{input}`
32
-
33
- if File.exist? output
34
- expected = File.read output
35
- ok = expected == result
36
- computed = output.sub('.out', '.computed')
37
- unless ok
38
- File.open(computed, 'w') { |f| f.write result }
39
- print `gvimdiff #{output} #{computed}` if $DEBUG
40
- end
41
- assert(ok, "Output error: #{computed} != #{output}") unless $DEBUG
42
- else
43
- File.open(output, 'w') do |f| f.write result end
44
- puts "New test: #{output}"
45
- end
46
-
47
- end
48
- end
49
- end
50
-
51
- end
52
-
53
- require 'test/unit/testsuite'
54
- $suite = TestSuite.new 'CodeRay Demos Test'
55
- $suite << CodeRaySuite.suite
56
-
57
- def load_suite name
58
- begin
59
- require name + '/suite.rb'
60
- rescue LoadError
61
- $stderr.puts <<-ERR
62
-
63
- !! Folder #{File.split(__FILE__).first + '/' + name} not found
64
-
65
- ERR
66
- false
67
- end
68
- end
69
-
70
- if subsuite = ARGV.find { |a| break $1 if a[/^([^-].*)/] }
71
- load_suite(subsuite) or exit
72
- else
73
- Dir[mydir + '/*/'].each { |suite| load_suite suite }
74
- end
75
-
76
- if ARGV.include? '-f'
77
- require 'test/unit/ui/fox/testrunner'
78
- UI::Fox::TestRunner.run $suite
79
- else
80
- require 'test/unit/ui/console/testrunner'
81
- UI::Console::TestRunner.run $suite
82
- end