about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-02-10 02:38:18 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-02-10 02:38:18 +0000
commitbce8665853fd1ef66771e462247c9712cf18f0b1 (patch)
tree566ebed98b6c8c94292894771c21fb799013481f /test
parent3c343cca6b736e43c6145ebdf60aed2cd61b912c (diff)
downloadunicorn-bce8665853fd1ef66771e462247c9712cf18f0b1.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@24 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'test')
-rw-r--r--test/test_uriclassifier.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/test_uriclassifier.rb b/test/test_uriclassifier.rb
index 05db8d2..b9b2778 100644
--- a/test/test_uriclassifier.rb
+++ b/test/test_uriclassifier.rb
@@ -115,7 +115,6 @@ class URIClassifierTest < Test::Unit::TestCase
     assert_equal 1, h, "wrong result for branching uri"
   end
 
-
   def test_all_prefixing
     tests = ["/test","/test/that","/test/this"]
     uri = "/test/this/that"
@@ -151,5 +150,27 @@ class URIClassifierTest < Test::Unit::TestCase
     assert_nil sn, "shoulnd't find anything"
     assert_nil pi, "shoulnd't find anything"
   end
+
+
+  # Verifies that a root mounted ("/") handler resolves
+  # such that path info matches the original URI.
+  # This is needed to accomodate real usage of handlers.
+  def test_root_mounted
+    u = URIClassifier.new
+    root = "/"
+    path = "/this/is/a/test"
+
+    u.register(root, 1)
+
+    sn, pi, h = u.resolve(root)
+    assert_equal 1,h, "didn't find handler"
+    assert_equal root,pi, "didn't get right path info"
+    assert_equal root,sn, "didn't get right script name"
+
+    sn, pi, h = u.resolve(path)
+    assert_equal path,pi, "didn't get right path info"
+    assert_equal root,sn, "didn't get right script name"
+    assert_equal 1,h, "didn't find handler"
+  end
 end