Remove Benchmark.h dependency in SpookyHash tests
[folly.git] / folly / test / UriTest.cpp
index 9796720315734a424a405d9592a0b06b2b35d151..cd1e8e4fdd6ed3e2e942341088dea1e8d371419a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include <folly/Uri.h>
 #include <folly/Benchmark.h>
+#include <folly/portability/GTest.h>
 
 #include <boost/algorithm/string.hpp>
 #include <glog/logging.h>
-#include <gtest/gtest.h>
 #include <map>
 
 using namespace folly;
@@ -239,7 +239,7 @@ TEST(Uri, Simple) {
     EXPECT_EQ("/etc/motd", u.path());
     EXPECT_EQ("", u.query());
     EXPECT_EQ("", u.fragment());
-    EXPECT_EQ("file:///etc/motd", u.fbstr());
+    EXPECT_EQ("file:/etc/motd", u.fbstr());
   }
 
   {
@@ -389,6 +389,29 @@ TEST(Uri, Simple) {
       // success
     }
   }
+
+  // No authority (no "//") is valid
+  {
+    fbstring s("this:is/a/valid/uri");
+    Uri u(s);
+    EXPECT_EQ("this", u.scheme());
+    EXPECT_EQ("is/a/valid/uri", u.path());
+    EXPECT_EQ(s, u.fbstr());
+  }
+  {
+    fbstring s("this:is:another:valid:uri");
+    Uri u(s);
+    EXPECT_EQ("this", u.scheme());
+    EXPECT_EQ("is:another:valid:uri", u.path());
+    EXPECT_EQ(s, u.fbstr());
+  }
+  {
+    fbstring s("this:is@another:valid:uri");
+    Uri u(s);
+    EXPECT_EQ("this", u.scheme());
+    EXPECT_EQ("is@another:valid:uri", u.path());
+    EXPECT_EQ(s, u.fbstr());
+  }
 }
 
 /**