SPUG: meeting tonight (notes)

Dan Sabath dan at concolor.org
Thu Mar 23 08:27:29 PST 2006

> Would someone be so kind as to take notes (mental or otherwise) and  
> post
> the SPUG Report following the meeting (so us folks that can't make  
> it can
> hear about what we missed), please? Thanks. Nothing detailed. See past
> reports for examples:

About 20 people showed up and listened to a very good talk by Jerry on
testing and Parrot. Jerry says he'll be posting his slides somewhere  
soon, but until then...



Preshow Notes:
	Audrey Tang, hoping perhaps here in the summer for a talk

Speaker: Jerry Gay
	Works on Process Automation and change management. Automating people  
of their jobs.

Working on Parrot, the VM that Perl6 will be running ...someday.

Some really cool stuff already, Jerry started just under a year ago.
Parrot project has doubled in the last year.

__Start of Talk__
Test::More, ok?

Jerry is responsible for the test suite of Parrot

Testing is simple,

	ok() simple to use.
	ok(foo () ==1 );
	ok(foo () eq 'bar', 'foo() returns "bar"' );
use_ok() require ok()

BEGIN { use_ok( 'My::Package', @imprts); }
is (), isnt(), like(), unlike()
is(foo(), 1 ' foo() returns 1');
like( foo(), qr/bar/, 'foo() return matches /bar/')

this one tests deep datastructures
	is_deeply($complex_structure1, $complex_structure2, $test_name);

skipping tests

skipping all tests
use Test::More skip_all => 'no real miniparrot yet';
marking tests TODO
	local $TODO = 'pending new Ref semantic'; pasm_output_is(<<CODE',
<<OUTPUT', "assign ref");
### put your test here
## put your expected results here
Select the number of tests to run
use Test::more tests => 3;
Conditional logic
	$^O =~ m/MSWin32/
		? plan tests => 17
		: plan skip_all => 'win32 only';

when you are developing the testfile you can mark it as "no_plan"
use Test::More qw( no_plan);
plan is like a test in itself.
if you use the plan function first you can use some conditional logic.
Methods of running tests
The tradional method.
	perl t/pod/doc.t

use a test harness
	perl t/harness t/pmc/resizable*.t

or a good method.
"Your code sucks, and I can Prove it!"
	prove t/pmc/intetger.t
prove offers a lot of flexiblility in testing, including test shuffling,
recursing to subdirs, verbose options,and dry runs.

if it all works prove returns "All tests successful."
in the case of a failure, you end up with dubious results
failure message, statistics, and a list of failed tests.
also a list of skipped tests

you can run prove in the verbose mode.
prove -v t/pmc/env.t
Test::Harness allows you to write your own tools

how is pir_output_is is written
	package Parrot::Test;
	use strict;
	use vars qw( @EXPORT @ISA);
	use Parrot::Config # written out to the disk at the time Parrot
         is compiled.

	#Exporting the routines
	# the set up
	my $builder = Test::Builder->new();
	sub import {
		my($class, $plan, @args) = @_;
	$builder->plan($plan, @args);
	__PACKAGE__->export_to_level(2, __PACKAGE__);

	sub generate_code {
		my ($code, $directory, $test_no, $code_f) = @_;
		open my $CODE, '>' $code_f or die "Unable to open
		binmode $CODE;
		print $CODE $code;
		close $CODE;

"setup temporary test filenames"

...then it gets really code deep...

run stuff through parrot and slurp it into a file.

then pass it into Test::More with the real method.

this allows us to express parrrot tests concisely, for example:
	pir_output_is(<<'CODE', <<'OUTPUT', "set_string_native");
	.sub main
	.local pmc pmcl
			pmc1 = new Integer
			pmc1 = "0124567"
			print pmc1
			print "\n"
Final Thoughts
	Precision happens sooner or later
	Testing helps increase precision in your code
	(and requirements)

Many test modueles
	RTFM: 	Test::Simple; Test::More; Test::Harness, Parrot::Test

lots more info at:

qa.perl.org/phalanx - tests for CPAN modules to test the most commonly
used perl modules

Test coverage. Devel::Cover, tests how well your test suite covers your
code, might be a future talk.

CPANTS: didn't catch what this was. There is a module that anytime a new
module is checked into CPAN will download it, run make test and send the
results back.

Suggested by Michael Wolf:
Possibly adopting a module for SPUG and writing tests for it as part of
the phalanx project.

__Q & A__
how to deal with tons of tests that might be spitting out a random  
need to write a description that allows you to find it.

Parrot::Test is written to spit out the line number as well.

generating tests.
using latin squares to generate tests, check mathworld.

co parrot (a subversion repo)
  take a look at some of the tests in t/op/comp_exp.t

YAPC::NA::2006 in Chicago
	will be held on June 26th-28th on the campus of the Illinois
	Institute of Technology.

Perlcast - podcast for perl

More information about the spug-list mailing list