Russ Cox | 68796b0 | 2010-02-01 00:25:59 -0800 | [diff] [blame] | 1 | // $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 Pike | 83976e3 | 2012-02-19 14:28:53 +1100 | [diff] [blame] | 7 | // Test that variadic functions work across package boundaries. |
| 8 | |
Russ Cox | 68796b0 | 2010-02-01 00:25:59 -0800 | [diff] [blame] | 9 | package main |
| 10 | |
| 11 | import "./ddd2" |
| 12 | |
| 13 | func main() { |
| 14 | if x := ddd.Sum(1, 2, 3); x != 6 { |
Rob Pike | 325cf8e | 2010-03-24 16:46:53 -0700 | [diff] [blame] | 15 | println("ddd.Sum 6", x) |
| 16 | panic("fail") |
Russ Cox | 68796b0 | 2010-02-01 00:25:59 -0800 | [diff] [blame] | 17 | } |
| 18 | if x := ddd.Sum(); x != 0 { |
Rob Pike | 325cf8e | 2010-03-24 16:46:53 -0700 | [diff] [blame] | 19 | println("ddd.Sum 0", x) |
| 20 | panic("fail") |
Russ Cox | 68796b0 | 2010-02-01 00:25:59 -0800 | [diff] [blame] | 21 | } |
| 22 | if x := ddd.Sum(10); x != 10 { |
Rob Pike | 325cf8e | 2010-03-24 16:46:53 -0700 | [diff] [blame] | 23 | println("ddd.Sum 10", x) |
| 24 | panic("fail") |
Russ Cox | 68796b0 | 2010-02-01 00:25:59 -0800 | [diff] [blame] | 25 | } |
| 26 | if x := ddd.Sum(1, 8); x != 9 { |
Rob Pike | 325cf8e | 2010-03-24 16:46:53 -0700 | [diff] [blame] | 27 | println("ddd.Sum 9", x) |
| 28 | panic("fail") |
Russ Cox | 68796b0 | 2010-02-01 00:25:59 -0800 | [diff] [blame] | 29 | } |
| 30 | } |