1// Copyright 2022 The PDFium Authors 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5function expect(expression, expected) { 6 try { 7 var actual = eval(expression); 8 if (actual == expected) { 9 app.alert('PASS: ' + expression + ' = ' + actual); 10 } else { 11 app.alert('FAIL: ' + expression + ' = ' + actual + ', expected ' + expected + " "); 12 } 13 } catch (e) { 14 app.alert('ERROR: ' + e); 15 } 16} 17 18function expectError(expression) { 19 try { 20 var actual = eval(expression); 21 app.alert('FAIL: ' + expression + ' = ' + actual + ', expected to throw'); 22 } catch (e) { 23 app.alert('PASS: ' + expression + ' threw ' + e); 24 } 25} 26