]> Cypherpunks.ru repositories - gostls13.git/blob - test/linkx_run.go
[dev.cc] all: merge dev.power64 (f57928630b36) into dev.cc
[gostls13.git] / test / linkx_run.go
1 // +build !nacl
2 // run
3
4 // Copyright 2014 The Go Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style
6 // license that can be found in the LICENSE file.
7
8 // Run the linkx test.
9
10 package main
11
12 import (
13         "fmt"
14         "os"
15         "os/exec"
16 )
17
18 func main() {
19         cmd := exec.Command("go", "run", "-ldflags=-X main.tbd hello -X main.overwrite trumped", "linkx.go")
20         out, err := cmd.CombinedOutput()
21         if err != nil {
22                 fmt.Println(string(out))
23                 fmt.Println(err)
24                 os.Exit(1)
25         }
26
27         want := "hello\ntrumped\n"
28         got := string(out)
29         if got != want {
30                 fmt.Printf("got %q want %q\n", got, want)
31                 os.Exit(1)
32         }
33 }