Ticket #685: TDD_tests.diff
| File TDD_tests.diff, 2.2 KB (added by kthakore, 4 years ago) |
|---|
-
lib/Padre/Action/Run.pm
71 71 $_[0]->on_run_command; 72 72 }, 73 73 ); 74 Padre::Action->new( 75 name => 'run.run_tdd_tests', 76 need_file => 1, 77 need_editor => 1, 78 label => Wx::gettext('Build + run all Tests'), 79 comment => Wx::gettext('Builds the current project, then run all tests.'), 80 shortcut => 'Ctrl-Shift-F5', 81 menu_event => sub { 82 $_[0]->on_run_tdd_tests; 83 }, 84 ); 74 85 75 86 Padre::Action->new( 76 87 name => 'run.run_tests', -
lib/Padre/Wx/Main.pm
1553 1553 return; 1554 1554 } 1555 1555 1556 =pod 1556 =pod 1557 1557 1558 =head3 on_run_tdd_tests 1559 1560 $main->on_run_tdd_tests; 1561 1562 Callback method, to build and then call on_run_tests 1563 1564 =cut 1565 1566 sub on_run_tdd_tests { 1567 my $self = shift; 1568 my $document = $self->current->document; 1569 unless ($document) { 1570 return $self->error( Wx::gettext("No document open") ); 1571 } 1572 1573 # Find the project 1574 my $project_dir = $document->project_dir; 1575 unless ($project_dir) { 1576 return $self->error( Wx::gettext("Could not find project root") ); 1577 1578 1579 } 1580 1581 my $dir = Cwd::cwd; 1582 chdir $project_dir; 1583 $self->run_command('perl Build test') if( -e 'Build'); 1584 1585 $self->run_command('make test') if( -e 'Makefile'); # this should do dmake, nmake so on 1586 chdir $dir; 1587 } 1588 1589 =pod 1590 1558 1591 =head3 on_run_tests 1559 1592 1560 1593 $main->on_run_tests; -
lib/Padre/Wx/Menu/Run.pm
49 49 $self, 50 50 'run.run_tests', 51 51 ); 52 53 $self->{run_tdd_tests} = $self->add_menu_action( 54 $self, 55 'run.run_tdd_tests', 56 ); 52 57 53 58 $self->{run_this_test} = $self->add_menu_action( 54 59 $self, … … 94 99 ? $self->{run_command}->IsEnabled 95 100 : 0 96 101 ); 102 $self->{run_tdd_tests}->Enable( 103 $document && defined( $document->filename ) 104 ? $self->{run_command}->IsEnabled 105 : 0 106 ); 97 107 98 108 return 1; 99 109 }
