Browse Source

Change some logging for tests

kindlich 4 years ago
parent
commit
1bf0933315
No known key found for this signature in database

+ 1
- 1
JavaIntegration/src/main/java/org/openzen/zencode/java/logger/ScriptingEngineStreamLogger.java View File

@@ -63,7 +63,7 @@ public class ScriptingEngineStreamLogger implements ScriptingEngineLogger {
63 63
     
64 64
     @Override
65 65
     public void logCompileException(CompileException exception) {
66
-        throw new UnsupportedOperationException();
66
+        throwingErr("Compile Exception:", exception);
67 67
     }
68 68
     
69 69
     @Override

+ 17
- 0
ScriptingExample/src/test/java/org/openzen/zenscript/scriptingexample/tests/helpers/ZenCodeTestLogger.java View File

@@ -9,6 +9,7 @@ public class ZenCodeTestLogger extends ScriptingEngineStreamLogger {
9 9
     
10 10
     private static final boolean logDebug = false;
11 11
     private final List<String> printlnOutputs = new ArrayList<>();
12
+    private final List<String> errors = new ArrayList<>();
12 13
     private boolean isEngineComplete = false;
13 14
     
14 15
     @Override
@@ -23,6 +24,18 @@ public class ZenCodeTestLogger extends ScriptingEngineStreamLogger {
23 24
         this.printlnOutputs.addAll(Arrays.asList(line.split(System.lineSeparator())));
24 25
     }
25 26
     
27
+    @Override
28
+    public void error(String message) {
29
+        errors.add(message);
30
+        super.error(message);
31
+    }
32
+    
33
+    @Override
34
+    public void throwingErr(String message, Throwable throwable) {
35
+        errors.add(message);
36
+        super.throwingErr(message, throwable);
37
+    }
38
+    
26 39
     void setEngineComplete() {
27 40
         isEngineComplete = true;
28 41
     }
@@ -40,4 +53,8 @@ public class ZenCodeTestLogger extends ScriptingEngineStreamLogger {
40 53
         }
41 54
         Assertions.assertEquals(size, printlnOutputs.size());
42 55
     }
56
+    
57
+    public void assertNoErrors() {
58
+        Assertions.assertEquals(0, errors.size());
59
+    }
43 60
 }

Loading…
Cancel
Save