about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-03-21 12:42:34 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-03-21 13:53:21 -0700
commit30c272cb3a42cfd842736ddb90133362fe899290 (patch)
tree5daa1ceb5c4570640b5d0a587b89cd350c985d6d /src/test
parent3e474424714f8e24fd1237d77cf88a3b35a495e5 (diff)
downloadrust-30c272cb3a42cfd842736ddb90133362fe899290.tar.gz
rust-30c272cb3a42cfd842736ddb90133362fe899290.zip
methods work
Cross-crate method calls don't work yet. Added
run-pass/class-method-cross-crate to test that, but it's xfailed

References to fields within methods don't work yet. Added
run-pass/class-methods to test that, but it's also xfailed
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/cci_class_2.rs15
-rw-r--r--src/test/run-pass/class-method-cross-crate.rs13
-rw-r--r--src/test/run-pass/class-methods.rs22
-rw-r--r--src/test/run-pass/classes-simple-method.rs6
4 files changed, 50 insertions, 6 deletions
diff --git a/src/test/auxiliary/cci_class_2.rs b/src/test/auxiliary/cci_class_2.rs
new file mode 100644
index 00000000000..50a5bf1e624
--- /dev/null
+++ b/src/test/auxiliary/cci_class_2.rs
@@ -0,0 +1,15 @@
+mod kitties {
+
+class cat {
+  priv {
+    let mutable meows : uint;
+  }
+
+  let how_hungry : int;
+
+  new(in_x : uint, in_y : int) { meows = in_x; how_hungry = in_y; }
+
+  fn speak() {}
+}
+
+}
diff --git a/src/test/run-pass/class-method-cross-crate.rs b/src/test/run-pass/class-method-cross-crate.rs
new file mode 100644
index 00000000000..1d79fa3f56d
--- /dev/null
+++ b/src/test/run-pass/class-method-cross-crate.rs
@@ -0,0 +1,13 @@
+// xfail-test
+// xfail-fast
+// aux-build:cci_class_2.rs
+use cci_class;
+import cci_class::kitties::*;
+
+fn main() {
+  let nyan : cat = cat(52u, 99);
+  let kitty = cat(1000u, 2);
+  assert(nyan.how_hungry == 99);
+  assert(kitty.how_hungry == 2);
+  nyan.speak();
+}
diff --git a/src/test/run-pass/class-methods.rs b/src/test/run-pass/class-methods.rs
new file mode 100644
index 00000000000..e9587b752cb
--- /dev/null
+++ b/src/test/run-pass/class-methods.rs
@@ -0,0 +1,22 @@
+// xfail-test
+class cat {
+  priv {
+    let mutable meows : uint;
+  }
+
+  let how_hungry : int;
+
+  new(in_x : uint, in_y : int) { meows = in_x; how_hungry = in_y; }
+
+  fn speak() { meows += 1u; }
+  fn meow_count() -> uint { meows }
+}
+
+fn main() {
+  let nyan : cat = cat(52u, 99);
+  let kitty = cat(1000u, 2);
+  assert(nyan.how_hungry == 99);
+  assert(kitty.how_hungry == 2);
+  nyan.speak();
+  assert(nyan.meow_count() == 53u);
+}
diff --git a/src/test/run-pass/classes-simple-method.rs b/src/test/run-pass/classes-simple-method.rs
index 2c7c2c7c480..62084958d5a 100644
--- a/src/test/run-pass/classes-simple-method.rs
+++ b/src/test/run-pass/classes-simple-method.rs
@@ -1,4 +1,3 @@
-// xfail-test
 class cat {
   priv {
     let mutable meows : uint;
@@ -9,10 +8,6 @@ class cat {
   new(in_x : uint, in_y : int) { meows = in_x; how_hungry = in_y; }
 
   fn speak() {}
-  /*
-  fn speak() { meows += 1u; }
-  fn meow_count() -> uint { meows }
-  */
 }
 
 fn main() {
@@ -21,5 +16,4 @@ fn main() {
   assert(nyan.how_hungry == 99);
   assert(kitty.how_hungry == 2);
   nyan.speak();
-  //  assert(nyan.meow_count() == 53u);
 }