[gnumeric] t2000-names-insdel.pl: new test



commit c6e18a47d02c98583c26715416232e7797d55bce
Author: Morten Welinder <terra gnome org>
Date:   Mon May 4 22:42:47 2009 -0400

    t2000-names-insdel.pl: new test
---
 test/.gitignore            |    1 +
 test/GnumericTest.pm       |   56 +++++++++++-
 test/Makefile.am           |    2 +
 test/t2000-names-insdel.pl |  211 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 268 insertions(+), 2 deletions(-)

diff --git a/test/.gitignore b/test/.gitignore
index 030544c..f22d2ce 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -3,3 +3,4 @@ Makefile
 .deps
 .libs
 import-db
+*~
diff --git a/test/GnumericTest.pm b/test/GnumericTest.pm
index cdf7fb5..b5265e6 100644
--- a/test/GnumericTest.pm
+++ b/test/GnumericTest.pm
@@ -7,16 +7,18 @@ use XML::Parser;
 
 @GnumericTest::ISA = qw (Exporter);
 @GnumericTest::EXPORT = qw(test_sheet_calc test_importer test_valgrind
-			   test_ssindex test_command message
+			   test_ssindex sstest test_command message
 			   $ssconvert $topsrc $samples $PERL);
 @GnumericTest::EXPORT_OK = qw(junkfile);
 
-use vars qw($topsrc $samples $ssconvert $ssindex $PERL $verbose);
+use vars qw($topsrc $samples $PERL $verbose);
+use vars qw($ssconvert $ssindex $sstest);
 $topsrc = "..";
 $samples = "$topsrc/samples";
 # FIXME.  The binaries might not be in the source tree.
 $ssconvert = "$topsrc/src/ssconvert";
 $ssindex = "$topsrc/src/ssindex";
+$sstest = "$topsrc/src/sstest";
 $verbose = 0;
 $PERL = $Config{'perlpath'};
 $PERL .= $Config{'_exe'} if $^O ne 'VMS' && $PERL !~ m/$Config{'_exe'}$/i;
@@ -132,6 +134,56 @@ sub test_command {
 
 # -----------------------------------------------------------------------------
 
+sub sstest {
+    my $test = shift @_;
+    my $expected = shift @_;
+
+    my $cmd = "$sstest $test";
+    my $actual = `$cmd 2>&1`;
+    my $err = $?;
+    die "Failed command: $cmd\n" if $err;
+
+    my $ok;
+    if (ref $expected) {
+	local $_ = $actual;
+	$ok = &$expected ($_);
+    } else {
+	my @actual = split ("\n", $actual);
+	chomp @actual;
+	while (@actual > 0 && $actual[-1] eq '') {
+	    my $dummy = pop @actual;
+	}
+
+	my @expected = split ("\n", $expected);
+	chomp @expected;
+	while (@expected > 0 && $expected[-1] eq '') {
+	    my $dummy = pop @expected;
+	}
+
+	my $i = 0;
+	while ($i < @actual && $i < @expected) {
+	    last if $actual[$i] ne $expected[$i];
+	    $i++;
+	}
+	if ($i < @actual || $i < @expected) {
+	    $ok = 0;
+	    print STDERR "Differences between actual and expected on line ", ($i + 1), ":\n";
+	    print STDERR "Actual  : ", ($i < @actual ? $actual[$i] : "-"), "\n";
+	    print STDERR "Expected: ", ($i < @expected ? $expected[$i] : "-"), "\n";
+	} else {
+	    $ok = 1;
+	}
+    }
+
+    if ($ok) {
+	print STDERR "Pass\n";
+    } else {
+	die "Fail.\n\n";
+    }
+}
+
+# -----------------------------------------------------------------------------
+
 sub test_sheet_calc {
     my $file = shift @_;
     my $pargs = (ref $_[0]) ? shift @_ : [];
diff --git a/test/Makefile.am b/test/Makefile.am
index e30d172..6bf1f4e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,6 +6,8 @@
 # 18xx:   Operators
 # 19xx:   Evaluation modes, regressions
 #
+# 2xxx: Internal sstest
+#
 # 5xxx: Importers
 # 59xx:   Minor formats
 #
diff --git a/test/t2000-names-insdel.pl b/test/t2000-names-insdel.pl
new file mode 100755
index 0000000..4e299f3
--- /dev/null
+++ b/test/t2000-names-insdel.pl
@@ -0,0 +1,211 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+
+my $expected;
+{ local $/; $expected = <DATA>; }
+
+&message ("Check insert/delete col/row's effect on names.");
+&sstest ("test_insdel_rowcol_names", $expected);
+
+__DATA__
+-----------------------------------------------------------------------------
+Start: test_insdel_rowcol_names
+-----------------------------------------------------------------------------
+
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+About to insert before column 3 on Sheet1
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to insert before column 2 on Sheet1
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to insert before column 1 on Sheet1
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to insert before column 0 on Sheet1
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$M$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$M$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$M$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to insert before column 3 on Sheet2
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to insert before column 2 on Sheet2
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to insert before column 1 on Sheet2
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to insert before column 0 on Sheet2
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$M$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to delete column 3 on Sheet1
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to delete column 2 on Sheet1
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to delete column 1 on Sheet1
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+About to delete column 0 on Sheet1
+Dumping names...
+Scope=Sheet1 Name="NAMEA1" Expr=A1
+Scope=Sheet1 Name="NAMEA1ABS" Expr=#REF!
+Scope=Sheet1 Name="NAMEA2" Expr=A2
+Scope=Sheet1 Name="NAMEA2ABS" Expr=#REF!
+Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
+Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
+Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
+Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
+Scope=Global Name="NAMEG2" Expr=$A$14+#REF!+Sheet2!$A$14
+Scope=Global Name="NAMEGA1" Expr=A1
+Dumping names... Done
+Undoing.
+Done.
+End: test_insdel_rowcol_names



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]