summaryrefslogtreecommitdiff
path: root/Examples/test-suite/go/catches_strings_runme.go
blob: b31565c247d88689c9d8f809cea7df0fde0996aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main

import "strings"
import . "swigtests/catches_strings"

func main() {
  {
    exception_thrown := false
    func() {
      defer func() {
        exception_thrown = strings.Index(recover().(string), "charstring message") == 0
      }()
      StringsThrowerCharstring()
    }()
    if !exception_thrown {
      panic(0)
    }
  }

  {
    exception_thrown := false
    func() {
      defer func() {
        exception_thrown = strings.Index(recover().(string), "stdstring message") == 0
      }()
      StringsThrowerStdstring()
    }()
    if !exception_thrown {
      panic(0)
    }
  }
}