From 581cbf27b13df62778b592158bf343c4dbf99276 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 5 Apr 2013 17:20:57 +1100 Subject: Added tests for Ruby and Perl lexers. --- test/examples/x.pl | 5 +++++ test/examples/x.pl.styled | 5 +++++ test/examples/x.rb | 6 ++++++ test/examples/x.rb.styled | 6 ++++++ test/lexTests.py | 6 ++++++ 5 files changed, 28 insertions(+) create mode 100644 test/examples/x.pl create mode 100644 test/examples/x.pl.styled create mode 100644 test/examples/x.rb create mode 100644 test/examples/x.rb.styled diff --git a/test/examples/x.pl b/test/examples/x.pl new file mode 100644 index 000000000..ba89f62a7 --- /dev/null +++ b/test/examples/x.pl @@ -0,0 +1,5 @@ +use strict; +while ( $r ) { + printf ( "Example text \n" ); + sleep 1; +} \ No newline at end of file diff --git a/test/examples/x.pl.styled b/test/examples/x.pl.styled new file mode 100644 index 000000000..74da4e911 --- /dev/null +++ b/test/examples/x.pl.styled @@ -0,0 +1,5 @@ +{5}use{0} {11}strict{10};{0} +{5}while{0} {10}({0} {12}$r{0} {10}){0} {10}{{0} + {5}printf{0} {10}({0} {6}"Example text \n"{0} {10});{0} + {5}sleep{0} {4}1{10};{0} +{10}} \ No newline at end of file diff --git a/test/examples/x.rb b/test/examples/x.rb new file mode 100644 index 000000000..234a6406b --- /dev/null +++ b/test/examples/x.rb @@ -0,0 +1,6 @@ +class Demo + def test # A test + i = 1 + puts "Example" + end +end \ No newline at end of file diff --git a/test/examples/x.rb.styled b/test/examples/x.rb.styled new file mode 100644 index 000000000..904d07dd3 --- /dev/null +++ b/test/examples/x.rb.styled @@ -0,0 +1,6 @@ +{5}class{0} {8}Demo{0} + {5}def{0} {9}test{0} {2}# A test{0} + {11}i{0} {10}={0} {4}1{0} + {11}puts{0} {6}"Example"{0} + {5}end{0} +{5}end \ No newline at end of file diff --git a/test/lexTests.py b/test/lexTests.py index 2a245649c..3c5ccc147 100644 --- a/test/lexTests.py +++ b/test/lexTests.py @@ -110,6 +110,12 @@ class TestLexers(unittest.TestCase): def testLua(self): self.LexExample("x.lua", b"lua", [b"function end"]) + def testRuby(self): + self.LexExample("x.rb", b"ruby", [b"class def end"]) + + def testPerl(self): + self.LexExample("x.pl", b"perl", [b"printf sleep use while"]) + def testD(self): self.LexExample("x.d", b"d", [b"keyword1", b"keyword2", b"", b"keyword4", b"keyword5", -- cgit v1.2.3