diff options
| author | Graydon Hoare <[email protected]> | 2010-08-05 10:04:11 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-08-05 10:04:11 -0700 |
| commit | 29987b56e1dafff4a850eef4e668a364340fc59b (patch) | |
| tree | 6b760dd4406b6bb0087f040626f1b0e37a542f82 /src/test | |
| parent | Add to std._io some formatter/type-specific-writer mechanism. Make a few typ... (diff) | |
| download | rust-29987b56e1dafff4a850eef4e668a364340fc59b.tar.xz rust-29987b56e1dafff4a850eef4e668a364340fc59b.zip | |
Move 'as' precedence up to just above relational; support indexing str and vec by all integral types. Closes #94.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/integral-indexing.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/run-pass/integral-indexing.rs b/src/test/run-pass/integral-indexing.rs new file mode 100644 index 00000000..fe7d147c --- /dev/null +++ b/src/test/run-pass/integral-indexing.rs @@ -0,0 +1,22 @@ +// This is a testcase for issue #94. + +fn main() { + + let vec[int] v = vec(0, 1, 2, 3, 4, 5); + let str s = "abcdef"; + check (v.(3u) == 3); + check (v.(3u8) == 3); + check (v.(3i8) == 3); + check (v.(3u32) == 3); + check (v.(3i32) == 3); + + log v.(3u8); + + check (s.(3u) == 'd' as u8); + check (s.(3u8) == 'd' as u8); + check (s.(3i8) == 'd' as u8); + check (s.(3u32) == 'd' as u8); + check (s.(3i32) == 'd' as u8); + + log s.(3u8); +}
\ No newline at end of file |