| 138 | } |
| 139 | |
| 140 | func testStdin(filters runtime.Filters) (runtime.Result, error) { |
| 141 | f, err := os.Stdin.Stat() |
| 142 | if err != nil { |
| 143 | return runtime.Result{}, err |
| 144 | } |
| 145 | |
| 146 | if (f.Mode() & os.ModeCharDevice) != 0 { |
| 147 | return runtime.Result{}, fmt.Errorf("Error: when testing from stdin the command is intended to work with pipes") |
| 148 | } |
| 149 | |
| 150 | r := bufio.NewReader(os.Stdin) |
| 151 | content, err := ioutil.ReadAll(r) |
| 152 | s := suite.ParseYAML(content, "") |
| 153 | |
| 154 | return execute(s, filters) |
| 155 | } |
| 156 | |
| 157 | func execute(s suite.Suite, filters runtime.Filters) (runtime.Result, error) { |
| 158 | tests := s.GetTests() |