blob: 82fce31499fe6efe32752d527e3e911c8fba8446 [file] [log] [blame]
Russ Cox68796b02010-02-01 00:25:59 -08001// $G $D/ddd2.go && $G $D/$F.go && $L $F.$A && ./$A.out
2
3// Copyright 2010 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
Rob Pike83976e32012-02-19 14:28:53 +11007// Test that variadic functions work across package boundaries.
8
Russ Cox68796b02010-02-01 00:25:59 -08009package main
10
11import "./ddd2"
12
13func main() {
14 if x := ddd.Sum(1, 2, 3); x != 6 {
Rob Pike325cf8e2010-03-24 16:46:53 -070015 println("ddd.Sum 6", x)
16 panic("fail")
Russ Cox68796b02010-02-01 00:25:59 -080017 }
18 if x := ddd.Sum(); x != 0 {
Rob Pike325cf8e2010-03-24 16:46:53 -070019 println("ddd.Sum 0", x)
20 panic("fail")
Russ Cox68796b02010-02-01 00:25:59 -080021 }
22 if x := ddd.Sum(10); x != 10 {
Rob Pike325cf8e2010-03-24 16:46:53 -070023 println("ddd.Sum 10", x)
24 panic("fail")
Russ Cox68796b02010-02-01 00:25:59 -080025 }
26 if x := ddd.Sum(1, 8); x != 9 {
Rob Pike325cf8e2010-03-24 16:46:53 -070027 println("ddd.Sum 9", x)
28 panic("fail")
Russ Cox68796b02010-02-01 00:25:59 -080029 }
30}