summaryrefslogtreecommitdiff
path: root/test/scanners
diff options
context:
space:
mode:
Diffstat (limited to 'test/scanners')
-rw-r--r--test/scanners/coderay_suite.rb9
-rw-r--r--test/scanners/debug/class.expected.raydebug1
-rw-r--r--test/scanners/php/namespaces.expected.raydebug9
-rw-r--r--test/scanners/php/namespaces.in.php9
4 files changed, 28 insertions, 0 deletions
diff --git a/test/scanners/coderay_suite.rb b/test/scanners/coderay_suite.rb
index 60f71be..3a98c6b 100644
--- a/test/scanners/coderay_suite.rb
+++ b/test/scanners/coderay_suite.rb
@@ -11,6 +11,8 @@ $:.unshift File.join($mydir, '..', 'lib')
require 'term/ansicolor' unless ENV['nocolor']
+require 'test/unit'
+
if defined? Term::ANSIColor
class String
include Term::ANSIColor
@@ -413,6 +415,13 @@ module CodeRay
return false
end
File.open(actual_html, 'w') { |f| f.write highlighted }
+ if okay
+ debug = $DEBUG
+ $DEBUG = false
+ FileUtils.copy(actual_html, name + '.expected.html')
+ $DEBUG = debug
+ end
+ true
end
expected_html = name + '.expected.html'
diff --git a/test/scanners/debug/class.expected.raydebug b/test/scanners/debug/class.expected.raydebug
index 501c99f..a53cdd6 100644
--- a/test/scanners/debug/class.expected.raydebug
+++ b/test/scanners/debug/class.expected.raydebug
@@ -12,3 +12,4 @@
< !! Folder )inline<delimiter(#{)constant(File)operator(.)ident(split)operator(()pre_constant(__FILE__)operator(\))operator(.)ident(first) operator(+) string<delimiter(')content(/)delimiter(')> operator(+) ident(name)delimiter(})>content( not found
---
> !! Folder )inline<inline_delimiter(#{)constant(File)operator(.)ident(split)operator(()pre_constant(__FILE__)operator(\))operator(.)ident(first) operator(+) string<delimiter(')content(/)delimiter(')> operator(+) ident(name)inline_delimiter(})>content( not found
+) \ No newline at end of file
diff --git a/test/scanners/php/namespaces.expected.raydebug b/test/scanners/php/namespaces.expected.raydebug
new file mode 100644
index 0000000..47074a9
--- /dev/null
+++ b/test/scanners/php/namespaces.expected.raydebug
@@ -0,0 +1,9 @@
+inline_delimiter(<?php)
+reserved(namespace) ident(foo)operator(;)
+reserved(use) ident(blah)operator(\\)ident(blah) reserved(as) ident(foo)operator(;)
+
+local_variable($a) operator(=) reserved(new) ident(my)operator(\\)ident(name)operator(()operator(\))operator(;) comment(// instantiates "foo\\my\\name" class)
+ident(foo)operator(\\)ident(bar)operator(::)ident(name)operator(()operator(\))operator(;) comment(// calls static method "name" in class "blah\\blah\\bar")
+ident(my)operator(\\)ident(bar)operator(()operator(\))operator(;) comment(// calls function "foo\\my\\bar")
+local_variable($a) operator(=) ident(my)operator(\\)constant(BAR)operator(;) comment(// sets $a to the value of constant "foo\\my\\BAR")
+inline_delimiter(?>)
diff --git a/test/scanners/php/namespaces.in.php b/test/scanners/php/namespaces.in.php
new file mode 100644
index 0000000..ad6a1a1
--- /dev/null
+++ b/test/scanners/php/namespaces.in.php
@@ -0,0 +1,9 @@
+<?php
+namespace foo;
+use blah\blah as foo;
+
+$a = new my\name(); // instantiates "foo\my\name" class
+foo\bar::name(); // calls static method "name" in class "blah\blah\bar"
+my\bar(); // calls function "foo\my\bar"
+$a = my\BAR; // sets $a to the value of constant "foo\my\BAR"
+?>