summaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2006-10-17 11:18:01 +0000
committermurphy <murphy@rubychan.de>2006-10-17 11:18:01 +0000
commit67aa3dfe0661b57ff9259edc3545fbcfd66ddd7e (patch)
treec28d5dcdd180d55eee4a5a7d062480a6282e4097 /test/functional
parent9e6f3debf5829049a277ad742901a088a0181d26 (diff)
downloadcoderay-67aa3dfe0661b57ff9259edc3545fbcfd66ddd7e.tar.gz
Declared Version 0.7.4!
Plugin#all_plugin_names is now called #list. Added some basic functional tests and adjusted statistic.rake.
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/basic.rb58
-rwxr-xr-xtest/functional/suite.rb8
2 files changed, 66 insertions, 0 deletions
diff --git a/test/functional/basic.rb b/test/functional/basic.rb
new file mode 100755
index 0000000..f5699ae
--- /dev/null
+++ b/test/functional/basic.rb
@@ -0,0 +1,58 @@
+require "test/unit"
+
+require "coderay"
+
+class Basic < Test::Unit::TestCase
+ def test_version
+ assert_nothing_raised do
+ CodeRay::VERSION
+ end
+ end
+
+ def test_classes_exist
+ assert_nothing_raised do
+ CodeRay
+ CodeRay::Encoders::Encoder
+ CodeRay::Encoders
+ CodeRay::Scanners::Scanner
+ CodeRay::Scanners
+ CodeRay::Tokens
+ CodeRay::TokenStream
+ Plugin
+ WordList
+ end
+ end
+
+ RUBY_TEST_CODE = 'puts "Hello, World!"'
+
+ def test_simple_scan
+ assert_nothing_raised do
+ CodeRay.scan(RUBY_TEST_CODE, :ruby)
+ end
+ end
+
+ def test_simple_highlight
+ assert_nothing_raised do
+ CodeRay.scan(RUBY_TEST_CODE, :ruby).html
+ end
+ end
+
+ def test_duo
+ assert_equal(RUBY_TEST_CODE,
+ CodeRay::Duo[:plain, :plain].highlight(RUBY_TEST_CODE))
+ end
+
+ ENCODERS_LIST = %w(
+ count debug div html null page span statistic text tokens xml yaml
+ )
+ def test_list_of_encoders
+ assert_equal(ENCODERS_LIST, CodeRay::Encoders.list)
+ end
+
+ SCANNERS_LIST = %w(
+ c delphi html nitro_xhtml plaintext rhtml ruby xml
+ )
+ def test_list_of_encoders
+ assert_equal(SCANNERS_LIST, CodeRay::Scanners.list)
+ end
+end \ No newline at end of file
diff --git a/test/functional/suite.rb b/test/functional/suite.rb
new file mode 100755
index 0000000..51f9a59
--- /dev/null
+++ b/test/functional/suite.rb
@@ -0,0 +1,8 @@
+require 'test/unit'
+require 'pathname'
+
+MYDIR = File.dirname(__FILE__)
+LIBDIR = Pathname.new(MYDIR).join('..', '..', 'lib').cleanpath
+$LOAD_PATH.unshift MYDIR, LIBDIR
+
+require 'basic' \ No newline at end of file