forked from mkrautz/objc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dealloc_test.go
36 lines (27 loc) · 841 Bytes
/
dealloc_test.go
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
33
34
35
36
// Copyright (c) 2012 The 'objc' Package Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package objc
import "testing"
type CustomDealloc struct {
Object `objc:"CustomDealloc : NSObject"`
}
func (cd *CustomDealloc) Dealloc() {
cd.SendSuperMsg("dealloc")
}
func TestGoObjectCustomDealloc(t *testing.T) {
c := NewClass(CustomDealloc{})
c.AddMethod("dealloc", (*CustomDealloc).Dealloc)
RegisterClass(c)
dc := GetClass("CustomDealloc").SendMsg("alloc").SendMsg("init")
dc.SendMsg("dealloc")
}
type StdDealloc struct {
Object `objc:"StdDealloc : NSObject"`
}
func TestGoObjectStandardDealloc(t *testing.T) {
c := NewClass(StdDealloc{})
RegisterClass(c)
dc := GetClass("StdDealloc").SendMsg("alloc").SendMsg("init")
dc.SendMsg("dealloc")
}