1; RUN: llvm-as -o %t %s
2; RUN: llvm-modextract -n 0 -o - %t | llvm-dis | FileCheck %s
3; RUN: not llvm-modextract -n 1 -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s
4; RUN: llvm-modextract -b -n 0 -o - %t | llvm-dis | FileCheck %s
5; RUN: not llvm-modextract -b -n 1 -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s
6
7; RUN: llvm-modextract -n 0 -o %t0 %t
8; RUN: llvm-dis -o - %t0 | FileCheck %s
9; RUN: llvm-modextract -b -n 0 -o %t1 %t
10; RUN: llvm-dis -o - %t1 | FileCheck %s
11
12; CHECK: define void @f()
13; ERROR: llvm-modextract: error: module index out of range; bitcode file contains 1 module(s)
14
15define void @f() {
16  ret void
17}
18