KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am unit testing a component that requires user input. How do I tell Test::More to use some input that I predefined so that I don't need to enter it manually? This is what I have now: use strict; use warnings; use Test::More; use TestClass; *STDIN = "1\n"; foreach my $file (@files) { #this constructor asks for user input if it cannot find the file (1 is ignore); my $test = TestClass->new( file=> @files ); isa_ok( $test, 'TestClass'); } done_testing; This code does press enter but the function is retrieving 0 not 1;
Tags (comma-separated)
Save Edits
Cancel