diff options
| author | Lindsey Kuper <[email protected]> | 2011-03-29 15:51:53 -0700 |
|---|---|---|
| committer | Lindsey Kuper <[email protected]> | 2011-03-29 15:59:15 -0700 |
| commit | 55fbed3d8d7078bfd3864e64cc044cbe876c5d1a (patch) | |
| tree | 3c0a53f8f59dbda781fda2a7ad1e5afcce719de2 /src/test | |
| parent | Ignore 'mutable foo' in plain field contexts. (diff) | |
| download | rust-55fbed3d8d7078bfd3864e64cc044cbe876c5d1a.tar.xz rust-55fbed3d8d7078bfd3864e64cc044cbe876c5d1a.zip | |
Beginnings of support for magical self prefix; nothing profound happening yet.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/self-missing-method.rs | 13 | ||||
| -rw-r--r-- | src/test/run-pass/obj-self.rs | 16 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/compile-fail/self-missing-method.rs b/src/test/compile-fail/self-missing-method.rs new file mode 100644 index 00000000..01c4ea14 --- /dev/null +++ b/src/test/compile-fail/self-missing-method.rs @@ -0,0 +1,13 @@ +// xfail-boot +// error-pattern:expecting ., found ( +fn main() { + + obj foo() { + fn m() { + self(); + } + } + + auto a = foo; + a.m(); +} diff --git a/src/test/run-pass/obj-self.rs b/src/test/run-pass/obj-self.rs new file mode 100644 index 00000000..741624fb --- /dev/null +++ b/src/test/run-pass/obj-self.rs @@ -0,0 +1,16 @@ +// xfail-boot +fn main() { + + obj foo() { + fn m1() { + log "hi!"; + } + fn m2() { + self.m1(); + } + } + + auto a = foo(); + a.m1(); + a.m2(); +} |