| 1 |
{-# LANGUAGE OverloadedStrings #-} |
| 2 |
{-# LANGUAGE QuasiQuotes #-} |
| 3 |
|
| 4 |
module URI.ByteStringQQTests (tests) where |
| 5 |
|
| 6 |
------------------------------------------------------------------------------- |
| 7 |
import Test.Tasty |
| 8 |
import Test.Tasty.HUnit |
| 9 |
------------------------------------------------------------------------------- |
| 10 |
import URI.ByteString |
| 11 |
import URI.ByteString.QQ |
| 12 |
|
| 13 |
------------------------------------------------------------------------------- |
| 14 |
|
| 15 |
quasiTest :: URI |
| 16 |
quasiTest = [uri|https://stackage.org/foo?bar=baz#quux|] |
| 17 |
|
| 18 |
quasiRelTest :: RelativeRef |
| 19 |
quasiRelTest = [relativeRef|/foo?bar=baz#quux|] |
| 20 |
|
| 21 |
tests :: TestTree |
| 22 |
tests = |
| 23 |
testGroup |
| 24 |
"URI.ByteString.QQ" |
| 25 |
[ testCase "uri quasi quoter produces expected RelativeRef" $ do |
| 26 |
quasiTest @?= URI (Scheme "https") (Just (Authority Nothing (Host "stackage.org") Nothing)) "/foo" (Query [("bar", "baz")]) (Just "quux"), |
| 27 |
testCase "relativeRef quasi quoter produces expected RelativeRef" $ do |
| 28 |
quasiRelTest @?= RelativeRef Nothing "/foo" (Query [("bar", "baz")]) (Just "quux") |
| 29 |
] |