diff --git a/src/CLI.cpp b/src/CLI.cpp index 754e2df4..48276358 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -412,7 +412,8 @@ void CLI::identifyIds () int digits; if (pig.skipLiteral ("@") && pig.getDigits (digits) && - pig.eos ()) + pig.eos () && + digits > 0) { a.tag ("ID"); a.attribute ("value", digits); diff --git a/test/ids.t b/test/ids.t index 2440dc02..4c67ac3a 100755 --- a/test/ids.t +++ b/test/ids.t @@ -48,6 +48,10 @@ class TestIds(TestCase): self.assertIn(' @1 ', out) self.assertIn(' @2 ', out) + def test_should_fail_on_zero_id(self): + code, out, err = self.t.runError("delete @0") + self.assertIn("IDs must be specified.", err) + if __name__ == "__main__": from simpletap import TAPTestRunner