Skip to content

Instantly share code, notes, and snippets.

@sergot
Created June 17, 2014 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergot/2660088af9f80d22316e to your computer and use it in GitHub Desktop.
Save sergot/2660088af9f80d22316e to your computer and use it in GitHub Desktop.
filip.sergot@c51255:~/p6/http-useragent$ perl6 -Ilib t/01-simple.t
1..4
ok 1 - get 1/1
not ok 2 - getprint 1/1
# got: '<!DOCTYPE html>
# <html>
# <head>
# <title>home :: filip.sergot.pl</title>
# <meta charset="UTF-8">
#
# <meta name="description" content="Mostly about programming. Perl, Perl6, C and many others. Science too.">
# <meta name="keywords" content="programming,perl,perl6,hacking,c,science">
# <meta name="author" content="Filip Sergot">
#
# <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
#
# <link rel="alternate" type="application/atom+xml" title="sergot's RSS" href="http://filip.sergot.pl/index.atom">
#
# <link rel="stylesheet" type="text/css" href="/css/style.css">
#
# <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
# <!-- There will be some JS, I promise! :) -->
# <script src="/js/main.js"></script>
#
# <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'/>
# <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'/>
#
# <!-- Piwik -->
# <script type="text/javascript">
# var _paq = _paq || [];
# _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
# _paq.push(["setCookieDomain", "*.sergot.pl"]);
# _paq.push(["setDomains", ["*.sergot.pl"]]);
# _paq.push(["trackPageView"]);
# _paq.push(["enableLinkTracking"]);
#
# (function() {
# var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.agilob.net/";
# _paq.push(["setTrackerUrl", u+"piwik.php"]);
# _paq.push(["setSiteId", "7"]);
# var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
# g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
# })();
# </script>
# <!-- End Piwik Code -->
# </head>
# <body>
# <div id="all">
# <div id="header">
# <div id="logo">
# <img src="/img/logo.jpg" class="logo" alt="Filip Sergot :: filip.sergot.pl :: logo" width="200" style="float: left; vertical-align: middle;">
# <div class="logotext">sergot's homepage</div>
# <div class="logodesc">Programming and stuff.</div>
# </div>
# <div id="menubarhor">
# <ul class="menubarhor">
# <li><a href="/en">ho'
# expected: '<!DOCTYPE html>
# <html>
# <head>
# <title>home :: filip.sergot.pl</title>
# <meta charset="UTF-8">
#
# <meta name="description" content="Mostly about programming. Perl, Perl6, C and many others. Science too.">
# <meta name="keywords" content="programming,perl,perl6,hacking,c,science">
# <meta name="author" content="Filip Sergot">
#
# <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
#
# <link rel="alternate" type="application/atom+xml" title="sergot's RSS" href="http://filip.sergot.pl/index.atom">
#
# <link rel="stylesheet" type="text/css" href="/css/style.css">
#
# <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
# <!-- There will be some JS, I promise! :) -->
# <script src="/js/main.js"></script>
#
# <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'/>
# <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'/>
#
# <!-- Piwik -->
# <script type="text/javascript">
# var _paq = _paq || [];
# _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
# _paq.push(["setCookieDomain", "*.sergot.pl"]);
# _paq.push(["setDomains", ["*.sergot.pl"]]);
# _paq.push(["trackPageView"]);
# _paq.push(["enableLinkTracking"]);
#
# (function() {
# var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.agilob.net/";
# _paq.push(["setTrackerUrl", u+"piwik.php"]);
# _paq.push(["setSiteId", "7"]);
# var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
# g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
# })();
# </script>
# <!-- End Piwik Code -->
# </head>
# <body>
# <div id="all">
# <div id="header">
# <div id="logo">
# <img src="/img/logo.jpg" class="logo" alt="Filip Sergot :: filip.sergot.pl :: logo" width="200" style="float: left; vertical-align: middle;">
# <div class="logotext">sergot's homepage</div>
# <div class="logodesc">Programming and stuff.</div>
# </div>
# <div id="menubarhor">
# <ul class="menubarhor">
# <li><a href="/en">home</a>'
not ok 3 - getstore 1/1
# got: '<!DOCTYPE html>
# <html>
# <head>
# <title>home :: filip.sergot.pl</title>
# <meta charset="UTF-8">
#
# <meta name="description" content="Mostly about programming. Perl, Perl6, C and many others. Science too.">
# <meta name="keywords" content="programming,perl,perl6,hacking,c,science">
# <meta name="author" content="Filip Sergot">
#
# <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
#
# <link rel="alternate" type="application/atom+xml" title="sergot's RSS" href="http://filip.sergot.pl/index.atom">
#
# <link rel="stylesheet" type="text/css" href="/css/style.css">
#
# <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
# <!-- There will be some JS, I promise! :) -->
# <script src="/js/main.js"></script>
#
# <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'/>
# <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'/>
#
# <!-- Piwik -->
# <script type="text/javascript">
# var _paq = _paq || [];
# _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
# _paq.push(["setCookieDomain", "*.sergot.pl"]);
# _paq.push(["setDomains", ["*.sergot.pl"]]);
# _paq.push(["trackPageView"]);
# _paq.push(["enableLinkTracking"]);
#
# (function() {
# var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.agilob.net/";
# _paq.push(["setTrackerUrl", u+"piwik.php"]);
# _paq.push(["setSiteId", "7"]);
# var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
# g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
# })();
# </script>
# <!-- End Piwik Code -->
# </head>
# <body>
# <div id="all">
# <div id="header">
# <div id="logo">
# <img src="/img/logo.jpg" class="logo" alt="Filip Sergot :: filip.sergot.pl :: logo" width="200" style="float: left; vertical-align: middle;">
# <div class="logotext">sergot's homepage</div>
# <div class="logodesc">Programming and stuff.</div>
# </div>
# <div id="menubarhor">
# <ul class="menubarhor">
# <li><a href="/en">ho'
# expected: '<!DOCTYPE html>
# <html>
# <head>
# <title>home :: filip.sergot.pl</title>
# <meta charset="UTF-8">
#
# <meta name="description" content="Mostly about programming. Perl, Perl6, C and many others. Science too.">
# <meta name="keywords" content="programming,perl,perl6,hacking,c,science">
# <meta name="author" content="Filip Sergot">
#
# <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
#
# <link rel="alternate" type="application/atom+xml" title="sergot's RSS" href="http://filip.sergot.pl/index.atom">
#
# <link rel="stylesheet" type="text/css" href="/css/style.css">
#
# <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
# <!-- There will be some JS, I promise! :) -->
# <script src="/js/main.js"></script>
#
# <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'/>
# <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'/>
#
# <!-- Piwik -->
# <script type="text/javascript">
# var _paq = _paq || [];
# _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
# _paq.push(["setCookieDomain", "*.sergot.pl"]);
# _paq.push(["setDomains", ["*.sergot.pl"]]);
# _paq.push(["trackPageView"]);
# _paq.push(["enableLinkTracking"]);
#
# (function() {
# var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.agilob.net/";
# _paq.push(["setTrackerUrl", u+"piwik.php"]);
# _paq.push(["setSiteId", "7"]);
# var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
# g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
# })();
# </script>
# <!-- End Piwik Code -->
# </head>
# <body>
# <div id="all">
# <div id="header">
# <div id="logo">
# <img src="/img/logo.jpg" class="logo" alt="Filip Sergot :: filip.sergot.pl :: logo" width="200" style="float: left; vertical-align: middle;">
# <div class="logotext">sergot's homepage</div>
# <div class="logodesc">Programming and stuff.</div>
# </div>
# <div id="menubarhor">
# <ul class="menubarhor">
# <li><a href="/en">home</a>'
1..3
ok 1 - 'use HTTP::UserAgent :simple; get('filip.sergot.pl/404here')' died
ok 2 - right exception type (X::HTTP::Response)
ok 3 - .message matches Response error: '404 Not Found'
ok 4 - did we throws_like X::HTTP::Response?
# Looks like you failed 2 tests of 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment