24
# Return a unique key that can be used to
25
# identify this test in a hash
35
$value =~ s/([|\\\x{0a}\x{0d}])/sprintf('\%02X', ord($1))/eg;
41
$value =~ s/\\([0-9a-fA-F]{2})/chr(hex($1))/ge;
47
my $result= $self->{result};
48
croak "'is_failed' can't be called until test has been run!"
49
unless defined $result;
51
return ($result eq 'MTR_RES_FAILED');
56
my ($test, $sock, $header)= @_;
58
# Give the test a unique key before serializing it
59
$test->{key}= "$test" unless defined $test->{key};
61
print $sock $header, "\n";
62
while ((my ($key, $value)) = each(%$test)) {
63
print $sock $key, "= ";
64
if (ref $value eq "ARRAY") {
65
print $sock "[", _encode(join(", ", @$value)), "]";
67
print $sock _encode($value);
77
my $test= My::Test->new();
78
# Read the : separated key value pairs until a
79
# single newline on it's own line
81
while (defined($line= <$sock>)) {
82
# List is terminated by newline on it's own
84
# Correctly terminated reply
85
# print "Got newline\n";
90
# Split key/value on the first "="
91
my ($key, $value)= split("= ", $line, 2);
93
if ($value =~ /^\[(.*)\]/){
94
my @values= split(", ", _decode($1));
95
push(@{$test->{$key}}, @values);
99
$test->{$key}= _decode($value);
109
print "[", $self->{name}, "]", "\n";
110
while ((my ($key, $value)) = each(%$self)) {
111
print " ", $key, "= ";
112
if (ref $value eq "ARRAY") {
113
print "[", join(", ", @$value), "]";