diff --git a/src/function/builtin/LOAD.java b/src/function/builtin/LOAD.java index 5c5d618..709fcff 100644 --- a/src/function/builtin/LOAD.java +++ b/src/function/builtin/LOAD.java @@ -66,7 +66,7 @@ public class LOAD extends LispFunction { try { parser = new LispParser(new FileInputStream(fileName), fileName); } catch (FileNotFoundException e) { - this.environment.getErrorManager().handle(new CouldNotLoadFileWarning(fileName)); + environment.getErrorManager().handle(new CouldNotLoadFileWarning(fileName)); } return parser; @@ -89,7 +89,7 @@ public class LOAD extends LispFunction { try { eval(parser.getNextSExpression()); } catch (LispException e) { - this.environment.getErrorManager().handle(e); + environment.getErrorManager().handle(e); return false; } } diff --git a/test/function/builtin/LOADTester.java b/test/function/builtin/LOADTester.java index b7a481b..dc55fa6 100644 --- a/test/function/builtin/LOADTester.java +++ b/test/function/builtin/LOADTester.java @@ -57,6 +57,14 @@ public class LOADTester { environment.reset(); } + @Test + public void loadEmptyFileName_ReturnsNilAndPrintsWarning() { + String input = "(load \"\")"; + + assertNil(evaluateString(input)); + assertWarningMessagePrinted(); + } + @Test public void loadGoodFile_ReturnsTAndPrintsNothing() { String input = "(load \"test/function/builtin/test-files/load-good.lisp\")"; @@ -74,7 +82,7 @@ public class LOADTester { } @Test - public void loadNonExistentFile_ReturnsNilAndPrintsError() { + public void loadNonExistentFile_ReturnsNilAndPrintsWarning() { String input = "(load \"doesNotExist.lisp\")"; assertNil(evaluateString(input));