Created
August 23, 2012 23:54
-
-
Save killerswan/3443731 to your computer and use it in GitHub Desktop.
io.rs str_reader shenanigans
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| // GIVEN THIS CHANGE IN libcore/io.rs | |
| fn str_reader(+ss: ~str) -> Reader { | |
| bytes_reader(str::bytes(ss)) | |
| } | |
| ... | |
| // THE FOLLOWING TESTS FAIL AND I DON'T YET KNOW WHY | |
| #[test] | |
| fn test_readchars_wide() { | |
| let wide_test = ~"生锈的汤匙切肉汤hello生锈的汤匙切肉汤"; | |
| let ivals : ~[int] = ~[ | |
| 29983, 38152, 30340, 27748, | |
| 21273, 20999, 32905, 27748, | |
| 104, 101, 108, 108, 111, | |
| 29983, 38152, 30340, 27748, | |
| 21273, 20999, 32905, 27748]; | |
| fn check_read_ln(len : uint, +ss: ~str, ivals: ~[int]) { | |
| let inp : io::Reader = io::str_reader(ss); | |
| let res : ~[char] = inp.read_chars(len); | |
| if (len <= vec::len(ivals)) { | |
| assert(vec::len(res) == len); | |
| } | |
| assert(vec::slice(ivals, 0u, vec::len(res)) == | |
| vec::map(res, |x| x as int)); | |
| } | |
| let mut i = 0u; | |
| while i < 8u { | |
| check_read_ln(i, wide_test, ivals); | |
| i += 1u; | |
| } | |
| // check a long read for good measure | |
| check_read_ln(128u, wide_test, ivals); | |
| } | |
| #[test] | |
| fn test_readchar() { | |
| let inp : io::Reader = io::str_reader(~"生"); | |
| let res : char = inp.read_char(); | |
| assert(res as int == 29983); | |
| } | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kunix:rust $ CFG_DISABLE_VALGRIND=1 make check TESTNAME=io::tests::test_readchar | |
| cfg: shell host triple x86_64-unknown-linux-gnu | |
| cfg: host for x86_64-unknown-linux-gnu is x86_64 | |
| cfg: unix-y environment | |
| cfg: using gcc | |
| cfg: disabling valgrind (CFG_DISABLE_VALGRIND) | |
| cfg: no llnextgen found, omitting grammar-verification | |
| cfg: including dist rules | |
| cfg: including test rules | |
| check: formatting | |
| compile_and_link: x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/libcore.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/libsyntax.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/librustc.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/bin/rustc | |
| cp: x86_64-unknown-linux-gnu/stage1/lib/libcore.so | |
| cp: x86_64-unknown-linux-gnu/stage1/lib/libstd.so | |
| cp: x86_64-unknown-linux-gnu/stage1/lib/libsyntax.so | |
| cp: x86_64-unknown-linux-gnu/stage1/lib/librustc.so | |
| cp: x86_64-unknown-linux-gnu/stage1/bin/rustc | |
| compile_and_link: x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib/libcore.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib/libsyntax.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib/librustc.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/bin/rustc | |
| cp: x86_64-unknown-linux-gnu/stage2/lib/libcore.so | |
| cp: x86_64-unknown-linux-gnu/stage2/lib/libstd.so | |
| cp: x86_64-unknown-linux-gnu/stage2/lib/libsyntax.so | |
| cp: x86_64-unknown-linux-gnu/stage2/lib/librustc.so | |
| cp: x86_64-unknown-linux-gnu/stage2/bin/rustc | |
| compile_and_link: x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libcore.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/libsyntax.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/librustc.so | |
| compile_and_link: x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/bin/rustdoc | |
| cp: x86_64-unknown-linux-gnu/stage2/bin/rustdoc | |
| rustdoc: doc/core/index.html | |
| rustdoc: doc/std/index.html | |
| compile_and_link: x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/bin/fuzzer | |
| cp: x86_64-unknown-linux-gnu/stage2/bin/fuzzer | |
| compile_and_link: x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/bin/cargo | |
| cp: x86_64-unknown-linux-gnu/stage2/bin/cargo | |
| compile_and_link: x86_64-unknown-linux-gnu/test/rustctest.stage2-x86_64-unknown-linux-gnu | |
| run: x86_64-unknown-linux-gnu/test/rustctest.stage2-x86_64-unknown-linux-gnu | |
| running 0 tests | |
| result: ok. 0 passed; 0 failed; 0 ignored | |
| compile_and_link: x86_64-unknown-linux-gnu/test/coretest.stage2-x86_64-unknown-linux-gnu | |
| run: x86_64-unknown-linux-gnu/test/coretest.stage2-x86_64-unknown-linux-gnu | |
| running 4 tests | |
| rust: task failed at 'Assertion vec::len(res) == len failed', /code/rust/src/libcore/io.rs:874 | |
| rust: task failed at 'Assertion res as int == 29983 failed', /code/rust/src/libcore/io.rs:892 | |
| test io::tests::test_readchar_empty ... ok | |
| test io::tests::test_readchars_empty ... ok | |
| test io::tests::test_readchars_wide ... FAILED | |
| test io::tests::test_readchar ... FAILED | |
| failures: | |
| io::tests::test_readchar | |
| io::tests::test_readchars_wide | |
| result: FAILED. 2 passed; 2 failed; 0 ignored | |
| rust: task failed at 'Some tests failed', /code/rust/src/libstd/test.rs:60 | |
| rust: domain main @0x192fb80 root task failed | |
| rust: task failed at 'killed', /code/rust/src/libcore/task.rs:549 | |
| make: *** [check-stage2-T-x86_64-unknown-linux-gnu-H-x86_64-unknown-linux-gnu-core-dummy] Error 101 | |
| kunix:rust $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment