summary refs log tree commit diff stats
path: root/tests/converter/tor_in_converter.nim
Commit message (Expand)AuthorAgeFilesLines
* fixes #4537Andreas Rumpf2016-08-021-0/+23
n28'>28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
discard """
  output: "1261129"
"""

# This file tests the JavaScript generator

import strutils

var
  inputElement = "1123"

proc onButtonClick(inputElement: string) {.exportc.} =
  let v = $inputElement
  if v.allCharsInSet(WhiteSpace):
    echo "only whitespace, hu?"
  else:
    var x = parseInt(v)
    echo x*x

onButtonClick(inputElement)

block:
  var s: string
  s.add("hi")
  doAssert(s == "hi")

block:
  var s: string
  s.insert("hi", 0)
  doAssert(s == "hi")

block:
  var s: string
  s.setLen(2)
  s[0] = 'h'
  s[1] = 'i'
  doAssert(s == "hi")

block:
  var s: seq[int]
  s.setLen(2)
  doAssert(s == @[0, 0])

block:
  var s: seq[int]
  s.insert(2, 0)
  doAssert(s == @[2])

block:
  var s: seq[int]
  s.add(2)
  doAssert(s == @[2])