From 74c9a0d2b32e45c0692b4cdad4eddcab1e6a74e3 Mon Sep 17 00:00:00 2001 From: murphy Date: Mon, 1 Jan 2007 03:03:04 +0000 Subject: Added tests for debug scanner and another ruby test case. Added drafts for a comparison of CodeRa an Pygments features. --- etc/language_report.textile | 59 ++++++ etc/output_report.textile | 34 ++++ test/scanners/debug/class.actual.html | 138 ++++++++++++++ test/scanners/debug/class.expected.raydebug | 14 ++ test/scanners/debug/class.in.raydebug | 14 ++ test/scanners/debug/kate.actual.html | 200 +++++++++++++++++++++ test/scanners/debug/kate.expected.raydebug | 76 ++++++++ test/scanners/debug/kate.in.raydebug | 76 ++++++++ test/scanners/debug/suite.rb | 3 + .../scanners/ruby/nested-heredoc.expected.raydebug | 27 +++ test/scanners/ruby/nested-heredoc.in.rb | 27 +++ 11 files changed, 668 insertions(+) create mode 100644 etc/language_report.textile create mode 100644 etc/output_report.textile create mode 100644 test/scanners/debug/class.actual.html create mode 100644 test/scanners/debug/class.expected.raydebug create mode 100644 test/scanners/debug/class.in.raydebug create mode 100644 test/scanners/debug/kate.actual.html create mode 100644 test/scanners/debug/kate.expected.raydebug create mode 100644 test/scanners/debug/kate.in.raydebug create mode 100644 test/scanners/debug/suite.rb create mode 100644 test/scanners/ruby/nested-heredoc.expected.raydebug create mode 100755 test/scanners/ruby/nested-heredoc.in.rb diff --git a/etc/language_report.textile b/etc/language_report.textile new file mode 100644 index 0000000..d79ed10 --- /dev/null +++ b/etc/language_report.textile @@ -0,0 +1,59 @@ +h1. CodeRay Missing Languages Report + +This is a list of input formats for highlighters, comparing Pygments with +CodeRay. + +h2. Lexers / Scanners + +h3. Supported by both + +* C +* Delphi/Pascal +* HTML +* RHTML +* Ruby +* XML + +h3. Only in CodeRay + +* Raydebug +* Nitro-XHTML + +h3. Only in Pygments, but soon in CodeRay + +* JavaScript +* CSS +* PHP +* Diff +* SQL + +h3. Soon only in CodeRay + +* IO +* YAML + +h3. Only in Pygments + +* Boo +* Brainfuck +* C++ +* C# +* Smarty +* Django +* Ini +* IRC +* Lua +* Makefile +* Perl +* Python +* VisualBasic +* TeX +* Python Console (pycon) +* Ruby Console (irb) + +h3. Missing totally + +* Haskell +* BBCode +* Wikicode +* JSON \ No newline at end of file diff --git a/etc/output_report.textile b/etc/output_report.textile new file mode 100644 index 0000000..2d8d5a2 --- /dev/null +++ b/etc/output_report.textile @@ -0,0 +1,34 @@ +h1. CodeRay Missing Outputs Report + +This is a list of output formats for highlighters, comparing Pygments with +CodeRay. + +h2. Formatters / Encoders + +h3. Supported by both + +* HTML +* Tokens (named raw in Pygments, raydebug or debug in CodeRay) +* Text + +h3. Only in CodeRay + +* Statistic and Counter +* Span, Div, Page (HTML variants) +* XML +* YAML + +h3. Only in Pygments, but soon in CodeRay + +h3. Soon only in CodeRay + +h3. Only in Pygments + +* LaTeX +* ANSI Console (very useful!) +* BBCode + +h3. Missing totally + +* PDF +* RTF (do we need this?) \ No newline at end of file diff --git a/test/scanners/debug/class.actual.html b/test/scanners/debug/class.actual.html new file mode 100644 index 0000000..1b55223 --- /dev/null +++ b/test/scanners/debug/class.actual.html @@ -0,0 +1,138 @@ + + + + + CodeRay HTML Encoder Example + + + + +
+
 1 37,38c37,38
+ 2 <       for input in Dir["*.#{extension}"]
+ 3 <         name = File.basename(input, ".#{extension}")
+ 4 ---
+ 5        for input in Dir["*.#{extension}"]
+ 6          name = File.basename(input, ".#{extension}")
+ 7 49c49
+ 8 <           puts "New test: #{output}"
+ 9 ---
+10            puts "New test: #{output}"
+11 69c69
+12 < !! Folder )#{File.split(__FILE__).first + '/' + name} not found
+13 ---
+14 > !! Folder #{File.split(__FILE__).first + '/' + name}content( not found
+15 
+
+ + + diff --git a/test/scanners/debug/class.expected.raydebug b/test/scanners/debug/class.expected.raydebug new file mode 100644 index 0000000..c0df683 --- /dev/null +++ b/test/scanners/debug/class.expected.raydebug @@ -0,0 +1,14 @@ +error(3)error(7)error(,)error(3)error(8)error(c)error(3)error(7)error(,)error(3)error(8) +error(<) reserved(for) ident(input) reserved(in) constant(Dir)operator([)stringdelimiter(")>operator(]) +error(<) ident(name) operator(=) constant(File)operator(.)ident(basename)operator(()ident(input)operator(,) stringdelimiter(")>operator(\)) +error(-)error(-)error(-) +> reserved(for) ident(input) reserved(in) constant(Dir)operator([)stringdelimiter(")>operator(]) +> ident(name) operator(=) constant(File)operator(.)ident(basename)operator(()ident(input)operator(,) stringdelimiter(")>operator(\)) +error(4)error(9)error(c)error(4)error(9) +error(<) ident(puts) stringdelimiter(")> +error(-)error(-)error(-) +> ident(puts) stringdelimiter(")> +error(6)error(9)error(c)error(6)error(9) +error(<) error(!)error(!) error(F)error(o)error(l)error(d)error(e)error(r) error(\))inline operator(+) ident(name)delimiter(})>content( not found +--- +> !! Folder )inline operator(+) ident(name)inline_delimiter(})>error(c)error(o)error(n)error(t)error(e)error(n)error(t)error(() error(n)error(o)error(t) error(f)error(o)error(u)error(n)error(d) diff --git a/test/scanners/debug/class.in.raydebug b/test/scanners/debug/class.in.raydebug new file mode 100644 index 0000000..501c99f --- /dev/null +++ b/test/scanners/debug/class.in.raydebug @@ -0,0 +1,14 @@ +37,38c37,38 +< reserved(for) ident(input) reserved(in) constant(Dir)operator([)stringdelimiter(")>operator(]) +< ident(name) operator(=) constant(File)operator(.)ident(basename)operator(()ident(input)operator(,) stringdelimiter(")>operator(\)) +--- +> reserved(for) ident(input) reserved(in) constant(Dir)operator([)stringdelimiter(")>operator(]) +> ident(name) operator(=) constant(File)operator(.)ident(basename)operator(()ident(input)operator(,) stringdelimiter(")>operator(\)) +49c49 +< ident(puts) stringdelimiter(")> +--- +> ident(puts) stringdelimiter(")> +69c69 +< !! Folder )inline operator(+) ident(name)delimiter(})>content( not found +--- +> !! Folder )inline operator(+) ident(name)inline_delimiter(})>content( not found diff --git a/test/scanners/debug/kate.actual.html b/test/scanners/debug/kate.actual.html new file mode 100644 index 0000000..48e02fb --- /dev/null +++ b/test/scanners/debug/kate.actual.html @@ -0,0 +1,200 @@ + + + + + CodeRay HTML Encoder Example + + + + +
+
 1 <?xml version="1.0" encoding="UTF-8"?>
+ 2 <!DOCTYPE language SYSTEM "language.dtd">
+ 3 <language name="Eiffel" version="1.02" kateversion="2.1" section="Sources" extensions="*.e" mimetype="text/x-eiffel-src">
+ 4         <highlighting>
+ 5                 <list name="keywords">
+ 6                         <item> indexing </item>
+ 7                         <item> class </item>
+ 8                         <item> inherit </item>
+ 9                         <item> creation </item>
+10                         <item> feature </item>
+11                         <item> rename </item>
+12                         <item> redefine </item>
+13                         <item> undefine </item>
+14                         <item> select </item>
+15                         <item> export </item>
+16                         <item> local </item>
+17                         <item> deferred </item>
+18                         <item> do </item>
+19                         <item> is </item>
+20                         <item> once </item>
+21                         <item> alias </item>
+22                         <item> external </item>
+23                         <item> rescue </item>
+24                         <item> debug </item>
+25                         <item> if </item>
+26                         <item> inspect </item>
+27                         <item> from </item>
+28                         <item> else </item>
+29                         <item> elseif </item>
+30                         <item> when </item>
+31                         <item> until </item>
+32                         <item> loop </item>
+33                         <item> then </item>
+34                         <item> obsolete </item>
+35                         <item> end </item>
+36                 </list>
+37                 <list name="assertions">
+38                         <item> check </item>
+39                         <item> ensure </item>
+40                         <item> require </item>
+41                         <item> variant </item>
+42                         <item> invariant </item>
+43                 </list>
+44                 <contexts>
+45                         <context attribute="Normal Text" lineEndContext="#stay" name="Normal">
+46                                 <keyword attribute="Keyword" context="#stay" String="keywords"/>
+47                                 <Float attribute="Float" context="#stay"/>
+48                                 <Int attribute="Decimal" context="#stay"/>
+49                                 <RegExpr attribute="Char" context="#stay" String="'.'"/>
+50                                 <DetectChar attribute="String" context="String" char="&quot;"/>
+51                                 <Detect2Chars attribute="Comment" context="Comment" char="-" char1="-"/>
+52                                 <keyword attribute="Assertions" context="#stay" String="assertions"/>
+53                         </context>
+54                         <context attribute="String" lineEndContext="#pop" name="String">
+55                                 <DetectChar attribute="String" context="#pop" char="&quot;"/>
+56                         </context>
+57                         <context attribute="Comment" name="Comment" lineEndContext="#pop"/>
+58                 </contexts>
+59                 <itemDatas>
+60                         <itemData name="Normal Text" defStyleNum="dsNormal" />
+61                         <itemData name="Keyword"     defStyleNum="dsKeyword" />
+62                         <itemData name="Decimal"     defStyleNum="dsDecVal" />
+63                         <itemData name="Float"       defStyleNum="dsFloat" />
+64                         <itemData name="Char"        defStyleNum="dsChar" />
+65                         <itemData name="String"      defStyleNum="dsString" />
+66                         <itemData name="Comment"     defStyleNum="dsComment" />
+67                         <itemData name="Assertions"  defStyleNum="dsOthers" />
+68                 </itemDatas>
+69   </highlighting>
+70   <general>
+71     <comments>
+72       <comment name="singleLine" start="--" />
+73     </comments>
+74     <keywords casesensitive="1" />
+75   </general>
+76 </language>
+77 
+
+ + + diff --git a/test/scanners/debug/kate.expected.raydebug b/test/scanners/debug/kate.expected.raydebug new file mode 100644 index 0000000..01eec5a --- /dev/null +++ b/test/scanners/debug/kate.expected.raydebug @@ -0,0 +1,76 @@ +preprocessor() +preprocessor() +tag( attribute_name(version)operator(=)string attribute_name(kateversion)operator(=)string attribute_name(section)operator(=)string attribute_name(extensions)operator(=)string attribute_name(mimetype)operator(=)stringtag(>) + tag() + tag(tag(>) + tag() plain(indexing )tag() + tag() plain(class )tag() + tag() plain(inherit )tag() + tag() plain(creation )tag() + tag() plain(feature )tag() + tag() plain(rename )tag() + tag() plain(redefine )tag() + tag() plain(undefine )tag() + tag() plain(select )tag() + tag() plain(export )tag() + tag() plain(local )tag() + tag() plain(deferred )tag() + tag() plain(do )tag() + tag() plain(is )tag() + tag() plain(once )tag() + tag() plain(alias )tag() + tag() plain(external )tag() + tag() plain(rescue )tag() + tag() plain(debug )tag() + tag() plain(if )tag() + tag() plain(inspect )tag() + tag() plain(from )tag() + tag() plain(else )tag() + tag() plain(elseif )tag() + tag() plain(when )tag() + tag() plain(until )tag() + tag() plain(loop )tag() + tag() plain(then )tag() + tag() plain(obsolete )tag() + tag() plain(end )tag() + tag() + tag(tag(>) + tag() plain(check )tag() + tag() plain(ensure )tag() + tag() plain(require )tag() + tag() plain(variant )tag() + tag() plain(invariant )tag() + tag() + tag() + tag( attribute_name(lineEndContext)operator(=)string attribute_name(name)operator(=)stringtag(>) + tag( attribute_name(context)operator(=)string attribute_name(String)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)string attribute_name(String)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)string attribute_name(char)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)string attribute_name(char)operator(=)string attribute_name(char1)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)string attribute_name(String)operator(=)stringtag(/>) + tag() + tag( attribute_name(lineEndContext)operator(=)string attribute_name(name)operator(=)stringtag(>) + tag( attribute_name(context)operator(=)string attribute_name(char)operator(=)stringtag(/>) + tag() + tag( attribute_name(name)operator(=)string attribute_name(lineEndContext)operator(=)stringtag(/>) + tag() + tag() + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag() + tag() + tag() + tag() + tag( attribute_name(start)operator(=)string tag(/>) + tag() + tag( tag(/>) + tag() +tag() diff --git a/test/scanners/debug/kate.in.raydebug b/test/scanners/debug/kate.in.raydebug new file mode 100644 index 0000000..01eec5a --- /dev/null +++ b/test/scanners/debug/kate.in.raydebug @@ -0,0 +1,76 @@ +preprocessor() +preprocessor() +tag( attribute_name(version)operator(=)string attribute_name(kateversion)operator(=)string attribute_name(section)operator(=)string attribute_name(extensions)operator(=)string attribute_name(mimetype)operator(=)stringtag(>) + tag() + tag(tag(>) + tag() plain(indexing )tag() + tag() plain(class )tag() + tag() plain(inherit )tag() + tag() plain(creation )tag() + tag() plain(feature )tag() + tag() plain(rename )tag() + tag() plain(redefine )tag() + tag() plain(undefine )tag() + tag() plain(select )tag() + tag() plain(export )tag() + tag() plain(local )tag() + tag() plain(deferred )tag() + tag() plain(do )tag() + tag() plain(is )tag() + tag() plain(once )tag() + tag() plain(alias )tag() + tag() plain(external )tag() + tag() plain(rescue )tag() + tag() plain(debug )tag() + tag() plain(if )tag() + tag() plain(inspect )tag() + tag() plain(from )tag() + tag() plain(else )tag() + tag() plain(elseif )tag() + tag() plain(when )tag() + tag() plain(until )tag() + tag() plain(loop )tag() + tag() plain(then )tag() + tag() plain(obsolete )tag() + tag() plain(end )tag() + tag() + tag(tag(>) + tag() plain(check )tag() + tag() plain(ensure )tag() + tag() plain(require )tag() + tag() plain(variant )tag() + tag() plain(invariant )tag() + tag() + tag() + tag( attribute_name(lineEndContext)operator(=)string attribute_name(name)operator(=)stringtag(>) + tag( attribute_name(context)operator(=)string attribute_name(String)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)string attribute_name(String)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)string attribute_name(char)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)string attribute_name(char)operator(=)string attribute_name(char1)operator(=)stringtag(/>) + tag( attribute_name(context)operator(=)string attribute_name(String)operator(=)stringtag(/>) + tag() + tag( attribute_name(lineEndContext)operator(=)string attribute_name(name)operator(=)stringtag(>) + tag( attribute_name(context)operator(=)string attribute_name(char)operator(=)stringtag(/>) + tag() + tag( attribute_name(name)operator(=)string attribute_name(lineEndContext)operator(=)stringtag(/>) + tag() + tag() + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag( attribute_name(defStyleNum)operator(=)string tag(/>) + tag() + tag() + tag() + tag() + tag( attribute_name(start)operator(=)string tag(/>) + tag() + tag( tag(/>) + tag() +tag() diff --git a/test/scanners/debug/suite.rb b/test/scanners/debug/suite.rb new file mode 100644 index 0000000..42503ee --- /dev/null +++ b/test/scanners/debug/suite.rb @@ -0,0 +1,3 @@ +class Debug < CodeRay::TestCase + extension :raydebug +end diff --git a/test/scanners/ruby/nested-heredoc.expected.raydebug b/test/scanners/ruby/nested-heredoc.expected.raydebug new file mode 100644 index 0000000..4aa4fed --- /dev/null +++ b/test/scanners/ruby/nested-heredoc.expected.raydebug @@ -0,0 +1,27 @@ +ident(p) stringoperator(.)ident(strip)operator(.)ident(reverse)inline_delimiter(})>char(\\ +)content(First +END +Second)delimiter(")> + +ident(p) shell operator(;) ident(p) stringinline_delimiter(})>delimiter(")>shellstring + +ident(this)operator(.)ident(should)operator(.)ident(be)operator(.)ident(plain) + +comment(# from Rails) +reserved(unless) ident(new_record?) + ident(connection)operator(.)ident(delete) stringoperator(,) stringcontent( Destroy)delimiter(")>stringcontent( + WHERE )inlinecontent( = )inlinedelimiter( + end_sql)> +reserved(end) + +ident(p) stringstringinline_delimiter(})>content( +code. +that)delimiter( +this)> +ident(that)operator(.)ident(should)operator(.)ident(be)operator(.)ident(plain) \ No newline at end of file diff --git a/test/scanners/ruby/nested-heredoc.in.rb b/test/scanners/ruby/nested-heredoc.in.rb new file mode 100755 index 0000000..3059e48 --- /dev/null +++ b/test/scanners/ruby/nested-heredoc.in.rb @@ -0,0 +1,27 @@ +p "#{<<'END'.strip.reverse}\ +First +END +Second" + +p <<`one` ; p "#{<