Skip to content

Commit

Permalink
Fix bug involving keywords for the tag command
Browse files Browse the repository at this point in the history
  • Loading branch information
Wong-ZZ committed Sep 16, 2020
1 parent ff5357f commit bfbb28e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/duke/task/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Parent class for all types of tasks that can be created by the user.
public abstract class Task {
public static final String TAGS_DELIMITER = "//tags ";
public static final String TAGS_DELIMITER = "//tags";
private static final String SYMBOL_DONE = "O";
private static final String SYMBOL_NOT_DONE = "X";

Expand Down Expand Up @@ -76,7 +76,7 @@ protected String getTagsSaveString() {
if (tags.isEmpty()) {
return "";
}
return TAGS_DELIMITER + stringifyTags();
return TAGS_DELIMITER + " " + stringifyTags();
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/duke/task/DeadlineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public void toSaveString() throws InvalidDeadlineException {
Deadline deadline = Deadline.createDeadline(description);
deadline.addTags(new String[]{"deadline1", "deadline2", "deadline3"});
String saveString = deadline.toSaveString();
String expected = "0deadline " + description + " " + Task.TAGS_DELIMITER + "#deadline1 #deadline2 #deadline3";
String expected = "0deadline " + description + " "
+ Task.TAGS_DELIMITER + " " + "#deadline1 #deadline2 #deadline3";
assertEquals(expected, saveString);
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/java/duke/task/EventTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public void toSaveString() throws InvalidEventException {
Event event = Event.createEvent(description);
event.addTags(new String[]{"event1", "event2", "event3"});
String saveString = event.toSaveString();
String expected = "0event " + description + " " + Task.TAGS_DELIMITER + "#event1 #event2 #event3";
String expected = "0event " + description + " "
+ Task.TAGS_DELIMITER + " " + "#event1 #event2 #event3";
assertEquals(expected, saveString);
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/java/duke/task/TodoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public void toSaveString() throws InvalidTodoException {
Todo todo = Todo.createTodo(description);
todo.addTags(new String[]{"todo1", "todo2", "todo3"});
String saveString = todo.toSaveString();
String expected = "0todo " + description + " " + Task.TAGS_DELIMITER + "#todo1 #todo2 #todo3";
String expected = "0todo " + description + " "
+ Task.TAGS_DELIMITER + " " + "#todo1 #todo2 #todo3";
assertEquals(expected, saveString);
}

Expand Down

0 comments on commit bfbb28e

Please sign in to comment.