Skip to content

Commit 7ed34d1

Browse files
committed
added a new flag enable_expectation_result to decide if hints should be visible or not. By default not, because it encourages copy paste approach.
1 parent d66d83e commit 7ed34d1

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎koans/app/config/config.properties‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ debug=false
33
exit_character=Q
44
enable_encouragement=false
55
path_xml_filename=PathToEnlightenment.xml
6+
enable_expectation_result=false

‎koans/app/lib/koans.jar‎

32.3 KB
Binary file not shown.

‎lib/src/main/java/com/sandwich/koan/ApplicationSettings.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public static boolean isDebug(){
2323
public static boolean isEncouragementEnabled(){
2424
return isEqual(getConfigBundle().getString("enable_encouragement"), true, true);
2525
}
26+
27+
public static boolean isExpectationResultVisible(){
28+
return isEqual(getConfigBundle().getString("enable_expectation_result"), true, true);
29+
}
2630

2731
public static char getExitChar(){
2832
return getConfigBundle().getString("exit_character").charAt(0);

‎lib/src/main/java/com/sandwich/koan/ui/ConsolePresenter.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ protected void displayAllSuccess(KoanSuiteResult result) {
7878
protected void displayOneOrMoreFailure(KoanSuiteResult result) {
7979
printSuggestion(result);
8080
String message = result.getMessage();
81-
StringBuilder sb = new StringBuilder(
82-
message == null || message.length() == 0 || !result.displayIncompleteException() ? ""
81+
StringBuilder sb = new StringBuilder();
82+
if (ApplicationSettings.isExpectationResultVisible()) {
83+
sb.append(message == null || message.length() == 0 || !result.displayIncompleteException() ? ""
8384
: new StringBuilder(Strings.getMessage("what_went_wrong")).append(
8485
": ").append(
8586
EOL).append(
8687
message).append(
8788
EOL));
89+
}
8890
if(ApplicationSettings.isEncouragementEnabled()){ // added noise to console output, and no real value
8991
int totalKoans = result.getTotalNumberOfKoans();
9092
int numberPassing = result.getNumberPassing();

0 commit comments

Comments
 (0)