summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-06-29 06:29:01 +0000
committermurphy <murphy@rubychan.de>2010-06-29 06:29:01 +0000
commit87764c224cc8c808688e83d7c1f93c8dbbbd9b4f (patch)
tree00a44069badf4bd0471aa8f3d4c8b639e9f1aa43 /test
parent0aebfa032c71cb4086fec6897a3cbb139e9befe4 (diff)
downloadcoderay-87764c224cc8c808688e83d7c1f93c8dbbbd9b4f.tar.gz
Remove tests that belong into the new test/unit folder.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/load_plugin_scanner.rb11
-rw-r--r--test/functional/vhdl.rb126
-rw-r--r--test/functional/word_list.rb79
3 files changed, 0 insertions, 216 deletions
diff --git a/test/functional/load_plugin_scanner.rb b/test/functional/load_plugin_scanner.rb
deleted file mode 100755
index 25bbc93..0000000
--- a/test/functional/load_plugin_scanner.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require 'test/unit'
-require 'coderay'
-
-class PluginScannerTest < Test::Unit::TestCase
-
- def test_load
- require File.join(File.dirname(__FILE__), 'vhdl')
- assert_equal 'VHDL', CodeRay.scanner(:vhdl).class.name
- end
-
-end
diff --git a/test/functional/vhdl.rb b/test/functional/vhdl.rb
deleted file mode 100644
index 3b8262b..0000000
--- a/test/functional/vhdl.rb
+++ /dev/null
@@ -1,126 +0,0 @@
-class VHDL < CodeRay::Scanners::Scanner
-
- register_for :vhdl
-
- RESERVED_WORDS = [
- 'access','after','alias','all','assert','architecture','begin',
- 'block','body','buffer','bus','case','component','configuration','constant',
- 'disconnect','downto','else','elsif','end','entity','exit','file','for',
- 'function','generate','generic','group','guarded','if','impure','in',
- 'inertial','inout','is','label','library','linkage','literal','loop',
- 'map','new','next','null','of','on','open','others','out','package',
- 'port','postponed','procedure','process','pure','range','record','register',
- 'reject','report','return','select','severity','signal','shared','subtype',
- 'then','to','transport','type','unaffected','units','until','use','variable',
- 'wait','when','while','with','note','warning','error','failure','and',
- 'or','xor','not','nor',
- 'array'
- ]
-
- PREDEFINED_TYPES = [
- 'bit','bit_vector','character','boolean','integer','real','time','string',
- 'severity_level','positive','natural','signed','unsigned','line','text',
- 'std_logic','std_logic_vector','std_ulogic','std_ulogic_vector','qsim_state',
- 'qsim_state_vector','qsim_12state','qsim_12state_vector','qsim_strength',
- 'mux_bit','mux_vector','reg_bit','reg_vector','wor_bit','wor_vector'
- ]
-
- PREDEFINED_CONSTANTS = [
-
- ]
-
- IDENT_KIND = CodeRay::CaseIgnoringWordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
- ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
- UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
-
- def scan_tokens tokens, options
-
- state = :initial
-
- until eos?
-
- kind = nil
- match = nil
-
- case state
-
- when :initial
-
- if scan(/ \s+ | \\\n /x)
- kind = :space
-
- elsif scan(/-- .*/x)
- kind = :comment
-
- elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d) /x)
- kind = :operator
-
- elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
- kind = IDENT_KIND[match.downcase]
-
- elsif match = scan(/[a-z]?"/i)
- tokens << [:open, :string]
- state = :string
- kind = :delimiter
-
- elsif scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox)
- kind = :char
-
- elsif scan(/(?:\d+)(?![.eEfF])/)
- kind = :integer
-
- elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
- kind = :float
-
- else
- getch
- kind = :error
-
- end
-
- when :string
- if scan(/[^\\\n"]+/)
- kind = :content
- elsif scan(/"/)
- tokens << ['"', :delimiter]
- tokens << [:close, :string]
- state = :initial
- next
- elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
- kind = :char
- elsif scan(/ \\ | $ /x)
- tokens << [:close, :string]
- kind = :error
- state = :initial
- else
- raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
- end
-
- else
- raise_inspect 'Unknown state', tokens
-
- end
-
- match ||= matched
- if $CODERAY_DEBUG and not kind
- raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
- end
- raise_inspect 'Empty token', tokens unless match
-
- tokens << [match, kind]
-
- end
-
- if state == :string
- tokens << [:close, :string]
- end
-
- tokens
- end
-
-end
diff --git a/test/functional/word_list.rb b/test/functional/word_list.rb
deleted file mode 100644
index 84d6e9e..0000000
--- a/test/functional/word_list.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-require 'test/unit'
-require 'coderay'
-
-class WordListTest < Test::Unit::TestCase
-
- include CodeRay
-
- # define word arrays
- RESERVED_WORDS = %w[
- asm break case continue default do else
- ...
- ]
-
- PREDEFINED_TYPES = %w[
- int long short char void
- ...
- ]
-
- PREDEFINED_CONSTANTS = %w[
- EOF NULL ...
- ]
-
- # make a WordList
- IDENT_KIND = WordList.new(:ident).
- add(RESERVED_WORDS, :reserved).
- add(PREDEFINED_TYPES, :pre_type).
- add(PREDEFINED_CONSTANTS, :pre_constant)
-
- def test_word_list_example
- assert_equal :pre_type, IDENT_KIND['void']
- # assert_equal :pre_constant, IDENT_KIND['...'] # not specified
- end
-
- def test_word_list
- list = WordList.new(:ident).add(['foobar'], :reserved)
- assert_equal :reserved, list['foobar']
- assert_equal :ident, list['FooBar']
- end
-
- def test_word_list_cached
- list = WordList.new(:ident, true).add(['foobar'], :reserved)
- assert_equal :reserved, list['foobar']
- assert_equal :ident, list['FooBar']
- end
-
- def test_case_ignoring_word_list
- list = CaseIgnoringWordList.new(:ident).add(['foobar'], :reserved)
- assert_equal :ident, list['foo']
- assert_equal :reserved, list['foobar']
- assert_equal :reserved, list['FooBar']
-
- list = CaseIgnoringWordList.new(:ident).add(['FooBar'], :reserved)
- assert_equal :ident, list['foo']
- assert_equal :reserved, list['foobar']
- assert_equal :reserved, list['FooBar']
- end
-
- def test_case_ignoring_word_list_cached
- list = CaseIgnoringWordList.new(:ident, true).add(['foobar'], :reserved)
- assert_equal :ident, list['foo']
- assert_equal :reserved, list['foobar']
- assert_equal :reserved, list['FooBar']
-
- list = CaseIgnoringWordList.new(:ident, true).add(['FooBar'], :reserved)
- assert_equal :ident, list['foo']
- assert_equal :reserved, list['foobar']
- assert_equal :reserved, list['FooBar']
- end
-
- def test_dup
- list = WordList.new(:ident).add(['foobar'], :reserved)
- assert_equal :reserved, list['foobar']
- list2 = list.dup
- list2.add(%w[foobar], :keyword)
- assert_equal :keyword, list2['foobar']
- assert_equal :reserved, list['foobar']
- end
-
-end \ No newline at end of file