summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/statistic.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-06-29 06:39:21 +0000
committermurphy <murphy@rubychan.de>2010-06-29 06:39:21 +0000
commite63682824ef4110152381bdb9b831378fe7baa4c (patch)
treecb28a1fc6ec57c51346ff2de4e390c7c417fb257 /lib/coderay/encoders/statistic.rb
parentc66ba1145eea6b846cc9f7427c740df5aada6436 (diff)
downloadcoderay-e63682824ef4110152381bdb9b831378fe7baa4c.tar.gz
Removing tests from library files. They live now in test/unit.
Diffstat (limited to 'lib/coderay/encoders/statistic.rb')
-rw-r--r--lib/coderay/encoders/statistic.rb65
1 files changed, 0 insertions, 65 deletions
diff --git a/lib/coderay/encoders/statistic.rb b/lib/coderay/encoders/statistic.rb
index 455da46..38464ce 100644
--- a/lib/coderay/encoders/statistic.rb
+++ b/lib/coderay/encoders/statistic.rb
@@ -1,4 +1,3 @@
-($:.unshift '../..'; require 'coderay') unless defined? CodeRay
module CodeRay
module Encoders
@@ -93,67 +92,3 @@ Token Types (%d):
end
end
-
-if $0 == __FILE__
- $VERBOSE = true
- $: << File.join(File.dirname(__FILE__), '..')
- eval DATA.read, nil, $0, __LINE__ + 4
-end
-
-__END__
-require 'test/unit'
-
-class StatisticEncoderTest < Test::Unit::TestCase
-
- def test_creation
- assert CodeRay::Encoders::Statistic < CodeRay::Encoders::Encoder
- stats = nil
- assert_nothing_raised do
- stats = CodeRay.encoder :statistic
- end
- assert_kind_of CodeRay::Encoders::Encoder, stats
- end
-
- TEST_INPUT = CodeRay::Tokens[
- ['10', :integer],
- ['(\\)', :operator],
- [:begin_group, :string],
- ['test', :content],
- [:end_group, :string],
- [:begin_line, :test],
- ["\n", :space],
- ["\n \t", :space],
- [" \n", :space],
- ["[]", :method],
- [:end_line, :test],
- ].flatten
- TEST_OUTPUT = <<-'DEBUG'
-
-Code Statistics
-
-Tokens 11
- Non-Whitespace 4
-Bytes Total 20
-
-Token Types (5):
- type count ratio size (average)
--------------------------------------------------------------
- TOTAL 11 100.00 % 1.8
- space 3 27.27 % 3.0
- begin_group 1 9.09 % 0.0
- begin_line 1 9.09 % 0.0
- content 1 9.09 % 4.0
- end_group 1 9.09 % 0.0
- end_line 1 9.09 % 0.0
- integer 1 9.09 % 2.0
- method 1 9.09 % 2.0
- operator 1 9.09 % 3.0
-
- DEBUG
-
- def test_filtering_text_tokens
- assert_equal TEST_OUTPUT, CodeRay::Encoders::Statistic.new.encode_tokens(TEST_INPUT)
- assert_equal TEST_OUTPUT, TEST_INPUT.statistic
- end
-
-end \ No newline at end of file