summary refs log tree commit diff stats
path: root/tests/ecmas.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ecmas.nim')
-rwxr-xr-xtests/ecmas.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/ecmas.nim b/tests/ecmas.nim
index e2c7a2107..12ed71309 100755
--- a/tests/ecmas.nim
+++ b/tests/ecmas.nim
@@ -13,8 +13,12 @@ var
   inputElement {.importc: "document.form1.input1", nodecl.}: ref TElement
 
 proc OnButtonClick() {.exportc.} =
-  var x = parseInt($inputElement.value)
-  echo x*x
+  let v = $inputElement.value
+  if v.allCharsInSet(whiteSpace):
+    echo "only whitespace, hu?"
+  else:
+    var x = parseInt(v)
+    echo x*x
 
 proc OnLoad() {.exportc.} = 
   echo "Welcome! Please take your time to fill in this formular!"