From 4e1c05bb8af5b862c594e2d730f229073ac681ea Mon Sep 17 00:00:00 2001 From: Bruno JOFRET Date: Thu, 14 Feb 2013 10:55:43 +0100 Subject: [PATCH] * Bug #9934 fixed - clear([["A","B"]) returns a non standard error message. Change-Id: I813cda8b3257928366e6b4d05fe2547e6122034e --- scilab/CHANGES_5.4.X | 2 ++ scilab/modules/core/sci_gateway/c/sci_clear.c | 2 +- .../core/tests/nonreg_tests/bug_9934.dia.ref | 20 +++++++++++++++++++ .../modules/core/tests/nonreg_tests/bug_9934.tst | 21 ++++++++++++++++++++ scilab/modules/core/tests/unit_tests/clear.dia.ref | 5 +++++ scilab/modules/core/tests/unit_tests/clear.tst | 5 +++++ 6 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 scilab/modules/core/tests/nonreg_tests/bug_9934.dia.ref create mode 100644 scilab/modules/core/tests/nonreg_tests/bug_9934.tst diff --git a/scilab/CHANGES_5.4.X b/scilab/CHANGES_5.4.X index a885699..2aeb2e9 100644 --- a/scilab/CHANGES_5.4.X +++ b/scilab/CHANGES_5.4.X @@ -230,6 +230,8 @@ Bug fixes * Bug #9305 fixed - In the optimisation help page, new chapter "Least Squares functions" created. +* Bug #9934 fixed - clear([["A","B"]) returns a non standard error message. + * Bug #10278 fixed - clear(1) returns a wrong error message. * Bug #10415 fixed - Remove a session line in history causes the removal diff --git a/scilab/modules/core/sci_gateway/c/sci_clear.c b/scilab/modules/core/sci_gateway/c/sci_clear.c index 7730a82..dec6b50 100644 --- a/scilab/modules/core/sci_gateway/c/sci_clear.c +++ b/scilab/modules/core/sci_gateway/c/sci_clear.c @@ -118,7 +118,7 @@ static int sci_clear_n_rhs(const char *fname) } else { - Scierror(999, _("%s: Wrong size for argument %d: Valid variable name expected.\n"), fname, k + 1); + Scierror(999, _("%s: Wrong size for argument %d: A single string expected.\n"), fname, k + 1); return 0; } } diff --git a/scilab/modules/core/tests/nonreg_tests/bug_9934.dia.ref b/scilab/modules/core/tests/nonreg_tests/bug_9934.dia.ref new file mode 100644 index 0000000..be651b3 --- /dev/null +++ b/scilab/modules/core/tests/nonreg_tests/bug_9934.dia.ref @@ -0,0 +1,20 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) Scilab Enterprises - 2012 - Simon MARCHETTO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 9934 --> +// +// <-- JVM NOT MANDATORY --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10278 +// +// <-- Short Description --> +// clear([A","B"]) returned a wrong error message +ierr = execstr("clear([""A"",""B""])", "errcatch"); +assert_checkequal(ierr, 999); +msg_ref = msprintf(gettext("%s: Wrong size for argument %d: A single string expected.\n"), "clear", 1); +assert_checkerror ("clear([""A"",""B""])", msg_ref); diff --git a/scilab/modules/core/tests/nonreg_tests/bug_9934.tst b/scilab/modules/core/tests/nonreg_tests/bug_9934.tst new file mode 100644 index 0000000..c246318 --- /dev/null +++ b/scilab/modules/core/tests/nonreg_tests/bug_9934.tst @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) Scilab Enterprises - 2012 - Simon MARCHETTO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug 9934 --> +// +// <-- JVM NOT MANDATORY --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10278 +// +// <-- Short Description --> +// clear(["A","B"]) returned a non standard error message + +ierr = execstr("clear([""A"",""B""])", "errcatch"); +assert_checkequal(ierr, 999); +msg_ref = msprintf(gettext("%s: Wrong size for argument %d: A single string expected.\n"), "clear", 1); +assert_checkerror ("clear([""A"",""B""])", msg_ref); diff --git a/scilab/modules/core/tests/unit_tests/clear.dia.ref b/scilab/modules/core/tests/unit_tests/clear.dia.ref index 89c6e62..99fada1 100644 --- a/scilab/modules/core/tests/unit_tests/clear.dia.ref +++ b/scilab/modules/core/tests/unit_tests/clear.dia.ref @@ -6,6 +6,7 @@ // ============================================================================= // <-- CLI SHELL MODE --> // +// <-- JVM NOT MANDATORY --> A = 2; B = 4; C = 6; @@ -34,5 +35,9 @@ ierr = execstr("clear(1)", "errcatch"); assert_checkequal(ierr, 201); msg_ref = msprintf(gettext("%s: Wrong type for argument %d: A single string expected.\n"), "clear", 1); assert_checkerror ("clear(1)", msg_ref); +ierr = execstr("clear([""A"",""B""])", "errcatch"); +assert_checkequal(ierr, 999); +msg_ref = msprintf(gettext("%s: Wrong size for argument %d: A single string expected.\n"), "clear", 1); +assert_checkerror ("clear([""A"",""B""])", msg_ref); ierr = execstr("clear toto", "errcatch"); assert_checkequal(ierr, 0); diff --git a/scilab/modules/core/tests/unit_tests/clear.tst b/scilab/modules/core/tests/unit_tests/clear.tst index 3992470..771148b 100644 --- a/scilab/modules/core/tests/unit_tests/clear.tst +++ b/scilab/modules/core/tests/unit_tests/clear.tst @@ -42,5 +42,10 @@ assert_checkequal(ierr, 201); msg_ref = msprintf(gettext("%s: Wrong type for argument %d: A single string expected.\n"), "clear", 1); assert_checkerror ("clear(1)", msg_ref); +ierr = execstr("clear([""A"",""B""])", "errcatch"); +assert_checkequal(ierr, 999); +msg_ref = msprintf(gettext("%s: Wrong size for argument %d: A single string expected.\n"), "clear", 1); +assert_checkerror ("clear([""A"",""B""])", msg_ref); + ierr = execstr("clear toto", "errcatch"); assert_checkequal(ierr, 0); -- 1.7.9.5