From bb09ed315ab5e6a262e9915e836f5361e162485e Mon Sep 17 00:00:00 2001 From: "E. Choroba" Date: Tue, 13 Oct 2020 01:29:24 +0200 Subject: [PATCH] Add tests for the Test adapter --- t/01-test_adapter.t | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 t/01-test_adapter.t diff --git a/t/01-test_adapter.t b/t/01-test_adapter.t new file mode 100755 index 0000000..eda54c0 --- /dev/null +++ b/t/01-test_adapter.t @@ -0,0 +1,25 @@ +#!/usr/bin/perl +use warnings; +use strict; + +{ package Foo; + use Measure::Everything qw( $stats ); + + sub frobnicate { + $stats->write(Foo => @_); + } +} + +use Test::More tests => 3; + +use Measure::Everything::Adapter; +my $m = Measure::Everything::Adapter->set('Test'); + +is_deeply $m->get_stats, [], 'initialized'; + +Foo::frobnicate(42); +Foo::frobnicate(13); +is_deeply $m->get_stats, [['Foo', 42], ['Foo', 13]], 'store'; + +$m->reset; +is_deeply $m->get_stats, [], 'reset';