2010-02-01 01:25:59 -07:00
|
|
|
// $G $D/ddd2.go && $G $D/$F.go && $L $F.$A && ./$A.out
|
|
|
|
|
2012-09-23 11:16:14 -06:00
|
|
|
// NOTE: This test is not run by 'run.go' and so not run by all.bash.
|
|
|
|
// To run this test you must use the ./run shell script.
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|