aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/compile-fail/export-no-tag-variants.rs17
-rw-r--r--src/test/run-pass/export-abstract-tag.rs19
-rw-r--r--src/test/run-pass/export-tag-variant.rs12
3 files changed, 48 insertions, 0 deletions
diff --git a/src/test/compile-fail/export-no-tag-variants.rs b/src/test/compile-fail/export-no-tag-variants.rs
new file mode 100644
index 00000000..69799802
--- /dev/null
+++ b/src/test/compile-fail/export-no-tag-variants.rs
@@ -0,0 +1,17 @@
+// xfail-boot
+// error-pattern: unresolved name
+
+// Tag variants are not exported with their tags. This allows for a
+// simple sort of ADT.
+
+mod foo {
+ export t;
+
+ tag t {
+ t1;
+ }
+}
+
+fn main() {
+ auto x = foo.t1;
+}
diff --git a/src/test/run-pass/export-abstract-tag.rs b/src/test/run-pass/export-abstract-tag.rs
new file mode 100644
index 00000000..b192b698
--- /dev/null
+++ b/src/test/run-pass/export-abstract-tag.rs
@@ -0,0 +1,19 @@
+// We can export tags without exporting the variants to create a simple
+// sort of ADT.
+
+mod foo {
+ export t;
+ export f;
+
+ tag t {
+ t1;
+ }
+
+ fn f() -> t {
+ ret t1;
+ }
+}
+
+fn main() {
+ let foo.t v = foo.f();
+}
diff --git a/src/test/run-pass/export-tag-variant.rs b/src/test/run-pass/export-tag-variant.rs
new file mode 100644
index 00000000..e99bc041
--- /dev/null
+++ b/src/test/run-pass/export-tag-variant.rs
@@ -0,0 +1,12 @@
+// Export the tag variants, without the tag
+
+mod foo {
+ export t1;
+ tag t {
+ t1;
+ }
+}
+
+fn main() {
+ auto v = foo.t1;
+}