about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-11-02 18:44:27 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-11-03 08:31:44 -0800
commit6478fcfafe390355c4cc2f7e22cfbf4cd1f5eeee (patch)
tree043fbec89cb67ff0f10a117c326d3d853b6417a0 /src/test
parent566ee9ecb3f40d8de93a9b4c5c90e1c26b12b5e1 (diff)
parent8e6e846d8a26e5a9d3aafd0bdcc18ed3ddf0cbca (diff)
downloadrust-6478fcfafe390355c4cc2f7e22cfbf4cd1f5eeee.tar.gz
rust-6478fcfafe390355c4cc2f7e22cfbf4cd1f5eeee.zip
rollup merge of #18470 : alexcrichton/dash-l
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/macro-include-items-expr.rs13
-rw-r--r--src/test/auxiliary/macro-include-items-item.rs13
-rw-r--r--src/test/compile-fail/manual-link-bad-form.rs17
-rw-r--r--src/test/compile-fail/manual-link-bad-kind.rs16
-rw-r--r--src/test/compile-fail/manual-link-framework.rs17
-rw-r--r--src/test/run-make/manual-link/Makefile7
-rw-r--r--src/test/run-make/manual-link/bar.c1
-rw-r--r--src/test/run-make/manual-link/foo.c1
-rw-r--r--src/test/run-make/manual-link/foo.rs19
-rw-r--r--src/test/run-make/manual-link/main.rs15
-rw-r--r--src/test/run-pass/macro-include-items.rs18
11 files changed, 137 insertions, 0 deletions
diff --git a/src/test/auxiliary/macro-include-items-expr.rs b/src/test/auxiliary/macro-include-items-expr.rs
new file mode 100644
index 00000000000..aea3c749930
--- /dev/null
+++ b/src/test/auxiliary/macro-include-items-expr.rs
@@ -0,0 +1,13 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-test: this is not a test
+
+1
diff --git a/src/test/auxiliary/macro-include-items-item.rs b/src/test/auxiliary/macro-include-items-item.rs
new file mode 100644
index 00000000000..da72aaef805
--- /dev/null
+++ b/src/test/auxiliary/macro-include-items-item.rs
@@ -0,0 +1,13 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-test: this is not a test
+
+fn foo() { bar() }
diff --git a/src/test/compile-fail/manual-link-bad-form.rs b/src/test/compile-fail/manual-link-bad-form.rs
new file mode 100644
index 00000000000..bd2a3eba0b5
--- /dev/null
+++ b/src/test/compile-fail/manual-link-bad-form.rs
@@ -0,0 +1,17 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:-l :static
+// error-pattern: empty library name given via `-l`
+
+fn main() {
+}
+
+
diff --git a/src/test/compile-fail/manual-link-bad-kind.rs b/src/test/compile-fail/manual-link-bad-kind.rs
new file mode 100644
index 00000000000..4614440ddaf
--- /dev/null
+++ b/src/test/compile-fail/manual-link-bad-kind.rs
@@ -0,0 +1,16 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:-l foo:bar
+// error-pattern: unknown library kind `bar`, expected one of dylib, framework, or static
+
+fn main() {
+}
+
diff --git a/src/test/compile-fail/manual-link-framework.rs b/src/test/compile-fail/manual-link-framework.rs
new file mode 100644
index 00000000000..96cc35049ee
--- /dev/null
+++ b/src/test/compile-fail/manual-link-framework.rs
@@ -0,0 +1,17 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-macos
+// ignore-ios
+// compile-flags:-l foo:framework
+// error-pattern: native frameworks are only available on OSX targets
+
+fn main() {
+}
diff --git a/src/test/run-make/manual-link/Makefile b/src/test/run-make/manual-link/Makefile
new file mode 100644
index 00000000000..d2a02adc9d4
--- /dev/null
+++ b/src/test/run-make/manual-link/Makefile
@@ -0,0 +1,7 @@
+-include ../tools.mk
+
+all: $(TMPDIR)/libbar.a
+	$(RUSTC) foo.rs -lbar:static
+	$(RUSTC) main.rs
+	$(call RUN,main)
+
diff --git a/src/test/run-make/manual-link/bar.c b/src/test/run-make/manual-link/bar.c
new file mode 100644
index 00000000000..e4259998678
--- /dev/null
+++ b/src/test/run-make/manual-link/bar.c
@@ -0,0 +1 @@
+void bar() {}
diff --git a/src/test/run-make/manual-link/foo.c b/src/test/run-make/manual-link/foo.c
new file mode 100644
index 00000000000..e4259998678
--- /dev/null
+++ b/src/test/run-make/manual-link/foo.c
@@ -0,0 +1 @@
+void bar() {}
diff --git a/src/test/run-make/manual-link/foo.rs b/src/test/run-make/manual-link/foo.rs
new file mode 100644
index 00000000000..d67a4057afb
--- /dev/null
+++ b/src/test/run-make/manual-link/foo.rs
@@ -0,0 +1,19 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type = "rlib"]
+
+extern {
+    fn bar();
+}
+
+pub fn foo() {
+    unsafe { bar(); }
+}
diff --git a/src/test/run-make/manual-link/main.rs b/src/test/run-make/manual-link/main.rs
new file mode 100644
index 00000000000..756a47f386a
--- /dev/null
+++ b/src/test/run-make/manual-link/main.rs
@@ -0,0 +1,15 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern crate foo;
+
+fn main() {
+    foo::foo();
+}
diff --git a/src/test/run-pass/macro-include-items.rs b/src/test/run-pass/macro-include-items.rs
new file mode 100644
index 00000000000..03eec668edd
--- /dev/null
+++ b/src/test/run-pass/macro-include-items.rs
@@ -0,0 +1,18 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn bar() {}
+
+include!(concat!("", "", "../auxiliary/", "macro-include-items-item.rs"))
+
+fn main() {
+    foo();
+    assert_eq!(include!(concat!("", "../auxiliary/", "macro-include-items-expr.rs")), 1u);
+}