[gnumeric] mps: fix rhs problem and update tests.



commit ef1d53049a94f9cbe8d908aa32ff89f0b013a907
Author: Morten Welinder <terra gnome org>
Date:   Thu Nov 19 15:41:59 2009 -0500

    mps: fix rhs problem and update tests.

 plugins/mps/mps.c |   12 +++++-------
 test/t5904-mps.pl |    4 ++--
 2 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/plugins/mps/mps.c b/plugins/mps/mps.c
index f2ecc5a..612979c 100644
--- a/plugins/mps/mps.c
+++ b/plugins/mps/mps.c
@@ -174,6 +174,9 @@ mps_mark_error (MpsState *state, const char *fmt, ...)
 	GOErrorInfo *error;
 	va_list args;
 
+	if (go_io_error_occurred (state->io_context))
+		return;
+
 	va_start (args, fmt);
 	error = go_error_info_new_vprintf (GO_ERROR, fmt, args);
 	va_end (args);
@@ -348,13 +351,8 @@ mps_parse_rhs (MpsState *state)
 		GPtrArray *split = state->split;
 		unsigned ui;
 
-		if (split->len % 2 == 1) {
-			mps_mark_error (state,
-					_("Invalid rhs line"));
-			continue;
-		}
-
-		for (ui = 0; ui < split->len; ui += 2) {
+		/* The name column is optional.  */
+		for (ui = split->len % 2; ui < split->len; ui += 2) {
 			const char *rowname = g_ptr_array_index (split, ui);
 			const char *valtxt = g_ptr_array_index (split, ui + 1);
 			MpsRow *row = g_hash_table_lookup (state->row_hash,
diff --git a/test/t5904-mps.pl b/test/t5904-mps.pl
index 4984f4d..5546af5 100755
--- a/test/t5904-mps.pl
+++ b/test/t5904-mps.pl
@@ -9,5 +9,5 @@ use GnumericTest;
 my $mode = ((shift @ARGV) || "check");
 
 &message ("Check the mps importer.");
-&test_importer ("$samples/solver/blend.mps", "dd5e3388a877b1f98f72d19dc3dad81fe8f3cd1a", $mode);
-&test_importer ("$samples/solver/afiro.mps", "7d5a4c944000a7db62758cafc1c2aba1942eb518", $mode);
+&test_importer ("$samples/solver/blend.mps", "500a4e0a17fcf7ad215594f194a87079dbcba0ac", $mode);
+&test_importer ("$samples/solver/afiro.mps", "2d82c1d1d3c6e9d7f5f8f1da6a1d60643945a0bf", $mode);



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