Home | History | Annotate | Download | only in callback
      1 // Copyright 2012 The Go Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style
      3 // license that can be found in the LICENSE file.
      4 
      5 package callback
      6 
      7 import (
      8 	"testing"
      9 )
     10 
     11 func TestCall(t *testing.T) {
     12 	c := NewCaller()
     13 	cb := NewCallback()
     14 
     15 	c.SetCallback(cb)
     16 	s := c.Call()
     17 	if s != "Callback::run" {
     18 		t.Errorf("unexpected string from Call: %q", s)
     19 	}
     20 	c.DelCallback()
     21 }
     22 
     23 func TestCallback(t *testing.T) {
     24 	c := NewCaller()
     25 	cb := NewDirectorCallback(&GoCallback{})
     26 	c.SetCallback(cb)
     27 	s := c.Call()
     28 	if s != "GoCallback.Run" {
     29 		t.Errorf("unexpected string from Call with callback: %q", s)
     30 	}
     31 	c.DelCallback()
     32 	DeleteDirectorCallback(cb)
     33 }
     34