1#! perl
2# Copyright (C) 2007, Parrot Foundation.
3# auto/backtrace-01.t
4
5use strict;
6use warnings;
7use Test::More tests => 14;
8use Carp;
9use lib qw( lib t/configure/testlib );
10use_ok('config::auto::backtrace');
11use Parrot::Configure::Options qw( process_options );
12use Parrot::Configure::Step::Test;
13use Parrot::Configure::Test qw(
14    test_step_constructor_and_description
15);
16
17########## regular ##########
18
19my ($args, $step_list_ref) = process_options( {
20    argv            => [],
21    mode            => q{configure},
22} );
23
24my $conf = Parrot::Configure::Step::Test->new;
25$conf->include_config_results( $args );
26
27my ($task, $step_name, $step, $ret);
28my $pkg = q{auto::backtrace};
29
30$conf->add_steps($pkg);
31
32my $serialized = $conf->pcfreeze();
33
34$conf->options->set(%{$args});
35$step = test_step_constructor_and_description($conf);
36
37$conf->replenish($serialized);
38
39########## _evaluate_backtrace()  ##########
40
41$conf->options->set(%{$args});
42$step = test_step_constructor_and_description($conf);
43my $error = q{mock_error};
44ok($step->_evaluate_backtrace($conf, $error),
45    "_evaluate_backtrace returned true value");
46is($step->result, 'no', "Got expected result");
47
48$error = q{};
49ok($step->_evaluate_backtrace($conf, $error),
50    "_evaluate_backtrace returned true value");
51is($step->result, 'yes', "Got expected result");
52ok($conf->data->get('backtrace'),
53    "backtrace set as expected");
54
55ok($step->runstep($conf), "runstep() returned true value");
56
57pass("Completed all tests in $0");
58
59################### DOCUMENTATION ###################
60
61=head1 NAME
62
63auto/backtrace-01.t - test auto::backtrace
64
65=head1 SYNOPSIS
66
67    % prove t/steps/auto/backtrace-01.t
68
69=head1 DESCRIPTION
70
71The files in this directory test functionality used by F<Configure.pl>.
72
73The tests in this file test auto::backtrace.
74
75=head1 AUTHOR
76
77James E Keenan
78
79=head1 SEE ALSO
80
81config::auto::backtrace, F<Configure.pl>.
82
83=cut
84
85# Local Variables:
86#   mode: cperl
87#   cperl-indent-level: 4
88#   fill-column: 100
89# End:
90# vim: expandtab shiftwidth=4:
91