#157: Change error message for non-positive IDs

This commit is contained in:
Janik Rabe 2018-08-07 15:31:01 +03:00 committed by lauft
parent 48aa9cfdc0
commit 616ca4b884
2 changed files with 5 additions and 3 deletions

View file

@ -412,9 +412,11 @@ void CLI::identifyIds ()
int digits;
if (pig.skipLiteral ("@") &&
pig.getDigits (digits) &&
pig.eos () &&
digits > 0)
pig.eos ())
{
if (digits <= 0)
throw format ("'@{1}' is not a valid ID.", digits);
a.tag ("ID");
a.attribute ("value", digits);
}

View file

@ -50,7 +50,7 @@ class TestIds(TestCase):
def test_should_fail_on_zero_id(self):
code, out, err = self.t.runError("delete @0")
self.assertIn("IDs must be specified.", err)
self.assertIn("'@0' is not a valid ID.", err)
if __name__ == "__main__":