+
+ my (@actual) = snarf ($test_txt);
+ my (@expected) = snarf ("$GRADES_DIR/sample.txt");
+
+ my ($eq);
+ if ($#actual == $#expected) {
+ $eq = 1;
+ for my $i (0...$#actual) {
+ $eq = 0 if $actual[$i] ne $expected[$i];
+ }
+ } else {
+ $eq = 0;
+ }
+ if (!$eq) {
+ my ($details);
+ $details = "Expected file content:\n";
+ $details .= join ('', map (" $_\n", @expected));
+ $details .= "Actual file content:\n";
+ $details .= join ('', map (" $_\n", @actual));
+ $extra{$test} = $details;
+
+ die "File written didn't have expected content.\n";
+ }