Created
September 14, 2016 12:30
-
-
Save unera/1ea008a89c4eddabdf65d7fc9affe163 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use utf8; | |
use open qw(:std :utf8); | |
use Test::More tests => 6; | |
BEGIN { | |
require_ok 'Mojolicious'; | |
use_ok 'Test::Mojo'; | |
} | |
{ | |
package TstApp; | |
use Mojo::Base 'Mojolicious'; | |
sub startup { | |
my ($self) = @_; | |
$self->routes | |
-> get('/ping') | |
-> to(cb => sub { return shift->render(text => 'pong') }) | |
-> name('ping'); | |
} | |
} | |
package main; | |
my $t = Test::Mojo->new('TstApp'); | |
note 'тесты mojo'; | |
$t -> get_ok('/ping') | |
-> status_is(200) | |
-> content_is('pong', 'Запрос выполнен успешно'); | |
note 'другие тесты'; | |
my $str_from_somewhere = 'Привет, медвед'; | |
like $str_from_somewhere => qr{\w,\s\w}, 'Еще тест прошел'; |
current mojo (git version)
1..6
ok 1 - require Mojolicious;
ok 2 - use Test::Mojo;
# тесты mojo
ok 3 - GET /ping
ok 4 - 200 OK
ok 5 - ÐапÑÐ¾Ñ Ð²Ñполнен ÑÑпеÑно
# другие тесты
ok 6 - Еще тест прошел
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
console log (old mojo):
without
#use open qw(:std :utf8);
without
use utf8