summary refs log tree commit diff stats
path: root/tests/bind
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bind')
-rw-r--r--tests/bind/mbind3.nim10
-rw-r--r--tests/bind/tbind1.nim21
-rw-r--r--tests/bind/tbind2.nim17
-rw-r--r--tests/bind/tbind3.nim11
-rw-r--r--tests/bind/tbindoverload.nim12
-rw-r--r--tests/bind/tdatabind.nim95
-rw-r--r--tests/bind/tinvalidbindtypedesc.nim11
-rw-r--r--tests/bind/tmixin.nim27
-rw-r--r--tests/bind/tnicerrorforsymchoice.nim18
9 files changed, 0 insertions, 222 deletions
diff --git a/tests/bind/mbind3.nim b/tests/bind/mbind3.nim
deleted file mode 100644
index 1a7d3b63b..000000000
--- a/tests/bind/mbind3.nim
+++ /dev/null
@@ -1,10 +0,0 @@
-# Module A
-var
-  lastId = 0
-
-template genId*: int =
-  bind lastId
-  inc(lastId)
-  lastId
-
-
diff --git a/tests/bind/tbind1.nim b/tests/bind/tbind1.nim
deleted file mode 100644
index 9b13a7d11..000000000
--- a/tests/bind/tbind1.nim
+++ /dev/null
@@ -1,21 +0,0 @@
-discard """
-  file: "tbind1.nim"
-  output: "3"
-"""
-# Test the new ``bind`` keyword for templates
-
-proc p1(x: int8, y: int): int = return x + y
-
-template tempBind(x, y): untyped =
-  bind p1
-  p1(x, y)
-
-proc p1(x: int, y: int8): int = return x - y
-
-# This is tricky: the call to ``p1(1'i8, 2'i8)`` should not fail in line 6,
-# because it is not ambiguous there. But it is ambiguous after line 8.
-
-echo tempBind(1'i8, 2'i8) #OUT 3
-
-
-
diff --git a/tests/bind/tbind2.nim b/tests/bind/tbind2.nim
deleted file mode 100644
index 799b14381..000000000
--- a/tests/bind/tbind2.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-discard """
-  file: "tbind2.nim"
-  line: 12
-  errormsg: "ambiguous call"
-"""
-# Test the new ``bind`` keyword for templates
-
-proc p1(x: int8, y: int): int = return x + y
-proc p1(x: int, y: int8): int = return x - y
-
-template tempBind(x, y): untyped =
-  (bind p1(x, y))  #ERROR_MSG ambiguous call
-
-echo tempBind(1'i8, 2'i8)
-
-
-
diff --git a/tests/bind/tbind3.nim b/tests/bind/tbind3.nim
deleted file mode 100644
index 551acc10f..000000000
--- a/tests/bind/tbind3.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-discard """
-  file: "tbind3.nim"
-  output: "1"
-"""
-# Module B
-import mbind3
-
-echo genId() #OUT 1
-
-
-
diff --git a/tests/bind/tbindoverload.nim b/tests/bind/tbindoverload.nim
deleted file mode 100644
index 6f5bb339e..000000000
--- a/tests/bind/tbindoverload.nim
+++ /dev/null
@@ -1,12 +0,0 @@
-import strtabs
-
-template t*() =
-  block:
-    bind newStringTable
-    discard {"Content-Type": "text/html"}.newStringTable()
-
-    discard {:}.newStringTable
-
-#discard {"Content-Type": "text/html"}.newStringTable()
-
-t()
diff --git a/tests/bind/tdatabind.nim b/tests/bind/tdatabind.nim
deleted file mode 100644
index 124faee6f..000000000
--- a/tests/bind/tdatabind.nim
+++ /dev/null
@@ -1,95 +0,0 @@
-discard """
-  disabled: true
-"""
-
-import events
-type
-  TProperty*[T] = object of TObject
-    getProc: proc(property: TProperty[T]): T {.nimcall.}
-    setProc: proc(property: var TProperty[T], value: T) {.nimcall.}
-    value: T
-    ValueChanged*: TEventHandler
-    Binders: seq[TProperty[T]]
-    EEmitter: TEventEmitter
-  # Not a descriptive name but it was that or TPropertyValueChangeEventArgs.
-  TValueEventArgs[T] = object of TEventArgs
-    Property*: TProperty[T]
-
-
-proc newProperty*[T](value: T): TProperty[T] =
-  var prop: TProperty[T]
-
-  prop.EEmitter = initEventEmitter()
-  prop.Binders = @[]
-  prop.ValueChanged = initEventHandler("ValueChanged")
-  prop.value = value
-
-  proc getter(property: TProperty[T]): T =
-   return property.value
-
-  prop.getProc = getter
-
-  proc setter(property: var TProperty[T], v: T) =
-    property.value = v
-
-    # fire event here
-    var args: TValueEventArgs[T]
-    args.Property = property
-    property.EEmitter.emit(property.ValueChanged, args)
-
-  prop.setProc = setter
-
-  return prop
-
-proc `prop`[T] (p: TProperty[T]): T =
-  # I'm assuming this is trying to get a value from the property.
-  # i.e. myVar = myProperty
-  return p.getProc(p)
-
-proc `~=`[T] (p: var TProperty[T], v: T) =
-  # Assuming this is setting the value.
-  p.setProc(p, v)
-
-proc `$`[T] (p: TProperty[T]): string =
-  var value = p.getProc(p)
-  return $value
-
-proc propertyBind*[T](p1: var TProperty[T], p2: var TProperty[T]) =
-  p1.Binders.add(p2)
-
-  # make handler -> handler[T] so trigger even more generics bugs ...
-  proc handler(e: TEventArgs) =
-    type TEA = TValueEventArgs[T]
-    var args = TEA(e)
-    var val = args.Property.getProc(p1)
-    for i in countup(0, len(e.Property.ValueChanged.Binders) -1):
-      var binded = e.Property.ValueChanged.Binders[i]
-      binded.setProc(binded, val)
-
-    echo("Property 1 has changed to " & $val)
-
-  if p1.ValueChanged.containsHandler(handler) == false:
-    addHandler(p1.ValueChanged, handler)
-
-proc `->`[T](p1: var TProperty[T], p2: var TProperty[T]) =
-  propertyBind(p2,p1)
-
-when isMainModule:
-  # Initial value testing
-  var myProp = newProperty(5)
-
-  echo(myProp)
-
-  myProp ~= 7 # Temp operator until overloading of '=' is implemented.
-  echo(myProp)
-
-  # Binding testing
-
-  var prop1 = newProperty(9)
-  var prop2: TProperty[int]
-
-  prop2 -> prop1 # Binds prop2 to prop1
-
-  prop1 ~= 7
-  echo(prop2) # Output: 7
-
diff --git a/tests/bind/tinvalidbindtypedesc.nim b/tests/bind/tinvalidbindtypedesc.nim
deleted file mode 100644
index ecdd12603..000000000
--- a/tests/bind/tinvalidbindtypedesc.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-discard """
-  line: 10
-  errormsg: "type mismatch: got <type float, string>"
-"""
-
-proc foo(T: typedesc; some: T) =
-  echo($some)
-
-foo int, 4
-foo float, "bad"
-
diff --git a/tests/bind/tmixin.nim b/tests/bind/tmixin.nim
deleted file mode 100644
index d841326a5..000000000
--- a/tests/bind/tmixin.nim
+++ /dev/null
@@ -1,27 +0,0 @@
-discard """
-  output: "1\n2"
-"""
-
-type
-  TFoo1 = object of TObject
-    v: int
-  TFoo2 = object of TFoo1
-    v2: int
-
-proc test(f: TFoo1) =
-  echo "1"
-
-proc Foo[T](f: T) =
-  mixin test
-  test(f)
-
-var
-  a: TFoo1
-  b: TFoo2
-
-
-proc test(f: TFoo2) =
-  echo "2"
-
-Foo(a)
-Foo(b)
diff --git a/tests/bind/tnicerrorforsymchoice.nim b/tests/bind/tnicerrorforsymchoice.nim
deleted file mode 100644
index 8c3a99c97..000000000
--- a/tests/bind/tnicerrorforsymchoice.nim
+++ /dev/null
@@ -1,18 +0,0 @@
-discard """
-  line: 18
-  errormsg: "type mismatch: got <proc (s: TScgi: ScgiState or AsyncScgiState) | proc (client: AsyncSocket, headers: StringTableRef, input: string){.noSideEffect, gcsafe, locks: 0.}>"
-"""
-
-#bug #442
-import scgi, sockets, asyncio, strtabs
-proc handleSCGIRequest[TScgi: ScgiState | AsyncScgiState](s: TScgi) =
-  discard
-proc handleSCGIRequest(client: AsyncSocket, headers: StringTableRef,
-                       input: string) =
-  discard
-
-proc test(handle: proc (client: AsyncSocket, headers: StringTableRef,
-                        input: string), b: int) =
-  discard
-
-test(handleSCGIRequest)