2010-02-01 01:25:59 -07:00
|
|
|
// Copyright 2010 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2012-02-18 20:28:53 -07:00
|
|
|
// Test that variadic functions work across package boundaries.
|
|
|
|
|
2010-02-01 01:25:59 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "./ddd2"
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
if x := ddd.Sum(1, 2, 3); x != 6 {
|
2010-03-24 17:46:53 -06:00
|
|
|
println("ddd.Sum 6", x)
|
|
|
|
panic("fail")
|
2010-02-01 01:25:59 -07:00
|
|
|
}
|
|
|
|
if x := ddd.Sum(); x != 0 {
|
2010-03-24 17:46:53 -06:00
|
|
|
println("ddd.Sum 0", x)
|
|
|
|
panic("fail")
|
2010-02-01 01:25:59 -07:00
|
|
|
}
|
|
|
|
if x := ddd.Sum(10); x != 10 {
|
2010-03-24 17:46:53 -06:00
|
|
|
println("ddd.Sum 10", x)
|
|
|
|
panic("fail")
|
2010-02-01 01:25:59 -07:00
|
|
|
}
|
|
|
|
if x := ddd.Sum(1, 8); x != 9 {
|
2010-03-24 17:46:53 -06:00
|
|
|
println("ddd.Sum 9", x)
|
|
|
|
panic("fail")
|
2010-02-01 01:25:59 -07:00
|
|
|
}
|
|
|
|
}
|