diff --git a/docs/UserGuide.md b/docs/UserGuide.md index b49cc02c549..3da8742a539 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -287,11 +287,12 @@ Executing command: `leave 1 m/1,3` Views all employees who are on leave, with optional filters of month and department. -Format: `view_leave [m/Month] [d/DEPARTMENT]` +Format: `view_leave [m/MONTHS] [d/DEPARTMENT]` - Gives a list of **all employees** who have leaves planned for the year. - The month and department are optional arguments. - If no one in the specified department has planned leave dates for the month, an output indicating **no employees is taking leave** is shown. +- Trailing commas in `MONTHS` (`view_leave m/1,2,3,,,`) will be ignored, but empty months elsewhere (`view_leave m/1,,,2`) will raise an error. Examples: - `view_leave` displays all employees who have planned leave dates in the current year. @@ -326,6 +327,7 @@ Format: `birthday [m/MONTH(s)]` - The month argument is optional. If **no month** is provided, the birthdays in the **current month** are listed. - If there is no birthday in the month provided, return **No employees have birthdays in this month**. - Months are separated using ",", e.g. to inquire the employees who have birthdays in Mar and Apr, the input is `birthday m/3,4`. +- Trailing commas in `MONTH(s)` (`birthday m/1,2,3,,,`) will be ignored, but empty months elsewhere (`birthday m/1,,,2`) will raise an error. Examples: - `birthday` displays all employees who have their birthday in the current month. @@ -377,7 +379,7 @@ Executing command: `sort name desc` ### Undoing previous commands: `undo` -Undo the most recent commands that modified the employee list, i.e., `add`, `edit`, `delete`, `leave`, `clear`, `sort`, `redo` commands. +Undo the most recent commands that modified the employee list, i.e., `add`, `edit`, `delete`, `leave`, `reset_leaves`, `clear`, `sort`, `redo` commands. Format: `undo` diff --git a/src/test/java/seedu/address/logic/parser/LeaveCommandParserTest.java b/src/test/java/seedu/address/logic/parser/LeaveCommandParserTest.java index 198b63e0c61..18fed312555 100644 --- a/src/test/java/seedu/address/logic/parser/LeaveCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/LeaveCommandParserTest.java @@ -17,6 +17,7 @@ public class LeaveCommandParserTest { @Test public void parse_validArgs_returnsLeaveCommand() { assertParseSuccess(parser, " 1 m/2", new LeaveCommand(INDEX_FIRST_PERSON, "0+0000000000")); + assertParseSuccess(parser, " 1 m/2,,,", new LeaveCommand(INDEX_FIRST_PERSON, "0+0000000000")); assertParseSuccess(parser, " 1 m/-2", new LeaveCommand(INDEX_FIRST_PERSON, "0-0000000000")); } @@ -45,5 +46,9 @@ public void parse_invalidArgs_throwsParseException() { assertParseFailure(parser, " 1 m/13", LeaveCommand.MESSAGE_INVALID_MONTH + LeaveCommand.MESSAGE_USAGE); assertParseFailure(parser, " 1 m/-13", LeaveCommand.MESSAGE_INVALID_MONTH + LeaveCommand.MESSAGE_USAGE); + + assertParseFailure(parser, " 1 m/1,,,3", LeaveCommand.MESSAGE_INVALID_MONTH + LeaveCommand.MESSAGE_USAGE); + + assertParseFailure(parser, " 1 m/1,123", LeaveCommand.MESSAGE_INVALID_MONTH + LeaveCommand.MESSAGE_USAGE); } }