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
     
63
     
64
     @Override
64
     @Override
65
     public void logCompileException(CompileException exception) {
65
     public void logCompileException(CompileException exception) {
66
-        throw new UnsupportedOperationException();
66
+        throwingErr("Compile Exception:", exception);
67
     }
67
     }
68
     
68
     
69
     @Override
69
     @Override

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

9
     
9
     
10
     private static final boolean logDebug = false;
10
     private static final boolean logDebug = false;
11
     private final List<String> printlnOutputs = new ArrayList<>();
11
     private final List<String> printlnOutputs = new ArrayList<>();
12
+    private final List<String> errors = new ArrayList<>();
12
     private boolean isEngineComplete = false;
13
     private boolean isEngineComplete = false;
13
     
14
     
14
     @Override
15
     @Override
23
         this.printlnOutputs.addAll(Arrays.asList(line.split(System.lineSeparator())));
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
     void setEngineComplete() {
39
     void setEngineComplete() {
27
         isEngineComplete = true;
40
         isEngineComplete = true;
28
     }
41
     }
40
         }
53
         }
41
         Assertions.assertEquals(size, printlnOutputs.size());
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