[svn:parrot] r39964 - in trunk: src/call t/op
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Thu Jul 9 17:40:40 UTC 2009
Author: chromatic
Date: Thu Jul 9 17:40:39 2009
New Revision: 39964
URL: https://trac.parrot.org/parrot/changeset/39964
Log:
[PCC] Humanized error reporting for argument overflow/underflow. Now Parrot
does not pluralize the word "param" or "result" if there's only one provided.
See Rakudo RT #67358. There's more discussion there about the wording change,
but the pluralization change is a clear benefit right now.
Modified:
trunk/src/call/pcc.c
trunk/t/op/cc_state.t
Modified: trunk/src/call/pcc.c
==============================================================================
--- trunk/src/call/pcc.c Thu Jul 9 17:25:32 2009 (r39963)
+++ trunk/src/call/pcc.c Thu Jul 9 17:40:39 2009 (r39964)
@@ -1415,10 +1415,11 @@
if (st->n_actual_args < min_expected_args) {
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "too few arguments passed (%d) - %s%d %s expected",
+ "too few arguments passed (%d) - %s%d %s%s expected",
st->n_actual_args,
(min_expected_args < max_expected_args ? "at least " : ""),
- min_expected_args, action);
+ min_expected_args, action,
+ (min_expected_args == 1 ? "" : "s"));
}
}
@@ -1443,10 +1444,11 @@
if (st->n_actual_args > max_expected_args) {
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "too many arguments passed (%d) - %s%d %s expected",
+ "too many arguments passed (%d) - %s%d %s%s expected",
st->n_actual_args,
(min_expected_args < max_expected_args ? "at most " : ""),
- max_expected_args, action);
+ max_expected_args, action,
+ (max_expected_args == 1 ? "" : "s"));
}
}
@@ -1623,7 +1625,7 @@
call_state_item *src, *dest;
const char * const action = (param_or_result == PARROT_PASS_RESULTS)
- ? "results" : "params";
+ ? "result" : "param";
/* Check if we should be throwing errors. This can be configured separately
* for parameters and return values. */
Modified: trunk/t/op/cc_state.t
==============================================================================
--- trunk/t/op/cc_state.t Thu Jul 9 17:25:32 2009 (r39963)
+++ trunk/t/op/cc_state.t Thu Jul 9 17:40:39 2009 (r39964)
@@ -1,13 +1,13 @@
#! perl
-# Copyright (C) 2006-2007, Parrot Foundation.
+# Copyright (C) 2006-2009, Parrot Foundation.
# $Id$
use strict;
use warnings;
use lib qw/. lib/;
-use Parrot::Test 'no_plan';
+use Parrot::Test tests => 15;
use Test::More;
## test description key
@@ -53,7 +53,7 @@
## G
pcc_error_like(
{ params => ".param pmc abc" },
- '/too few arguments passed \(0\) - 1 params expected/',
+ '/too few arguments passed \(0\) - 1 param expected/',
'G1: argument underflow: required param',
);
More information about the parrot-commits
mailing list