Index: testing/resources/javascript/util_bytetochar.in |
diff --git a/testing/resources/javascript/apply.in b/testing/resources/javascript/util_bytetochar.in |
similarity index 51% |
copy from testing/resources/javascript/apply.in |
copy to testing/resources/javascript/util_bytetochar.in |
index 1342c1af4e71c86dfd01b091d0f9fbe68cebfe69..a9adfbccaf72a01349c5639c46afc42046bed7da 100644 |
--- a/testing/resources/javascript/apply.in |
+++ b/testing/resources/javascript/util_bytetochar.in |
@@ -34,36 +34,37 @@ endobj |
{{object 11 0}} << |
>> |
stream |
-app.alert('Applying to util itself - should succeed'); |
-try { |
- app.alert(util.byteToChar.apply(util, [65])); |
-} |
-catch (e) { |
- app.alert('Caught: ' + e); |
-} |
- |
-app.alert('Applying to array - should throw'); |
-try { |
- app.alert(util.byteToChar.apply([], [65])); |
-} |
-catch (e) { |
- app.alert('Caught: ' + e); |
+function TestOneInput(x) { |
+ try { |
+ var s = util.byteToChar(x); |
+ if (s.length) { |
+ s = s.charCodeAt(0); |
+ } |
+ app.alert(x + " => " + s); |
+ } |
+ catch (e) { |
+ app.alert(x + ": Caught error: " + e); |
+ } |
} |
- |
-app.alert('Applying to number - should throw'); |
+TestOneInput(0); |
+TestOneInput(65); |
+TestOneInput(127); |
+TestOneInput(128); |
+TestOneInput(255); |
+TestOneInput(256); |
+TestOneInput(40000000); |
+TestOneInput(-1); |
try { |
- app.alert(util.byteToChar.apply(7, [65])); |
+ util.byteToChar(); |
} |
catch (e) { |
- app.alert('Caught: ' + e); |
+ app.alert("Caught expected error: " + e); |
} |
- |
-app.alert('Applying to wrong native obj - should throw'); |
try { |
- app.alert(util.byteToChar.apply(app, [65])); |
+ util.byteToChar({x:39}); |
} |
catch (e) { |
- app.alert('Caught: ' + e); |
+ app.alert("Caught expected error: " + e); |
} |
endstream |
endobj |