-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests support control chars widths 0 or 1 #789
Tests support control chars widths 0 or 1 #789
Conversation
3c9b021
to
ccbfa38
Compare
Thanks for the PR! I just pushed a change that only marks some backends "persistent". The puppet backend defaults to non-persistent. |
that commit is not pushed yet? I only see this one: 2a7b368 therefore
I tested via: $ cargo test --example select_test -- --nocapture
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.08s
Running unittests examples/select_test.rs (target/x86_64-unknown-linux-gnu/debug/examples/select_test-d45f2e1e4022a737)
running 3 tests
captured piece:
x01234567890123456789012345678901234567890123456789012345678901234567890123456789x
0 |
1 |
2 ┌┤ Where are you from? ├┐ |
3 │ Abidjan ▒ │ |
4 │ Abu Dhabi | │ |
5 │ Abuja | │ |
6 │ Accra | │ |
7 │ Adamstown | │ |
8 │ Addis Ababa | │ |
9 │ Algiers | │ |
0 │ Alofi | │ |
1 │ Amman | │ |
2 │ Amsterdam | │ |
3 └───────────────────────┘ |
4 |
5 |
x--------------------------------------------------------------------------------x
captured piece:
x01234567890123456789012345678901234567890123456789012345678901234567890123456789x
0................................................................................|
1................................................................................|
2................................................................................|
3............................. short nul 1str .|...............................|
4................................. 1thru8 ......................................|
5...............................tabandnewline....................................|
6..................................bthru15.......................................|
7................................. 16thru1F......................................|
8................................ 7Fonly .....................................|
9..................................80thru89......................................|
0..................................8.thru93......................................|
1..................................94thru9D......................................|
2............................. 9Ethru9F .▒...............................|
3................................................................................|
4................................................................................|
5................................................................................|
x--------------------------------------------------------------------------------x
captured piece:
x01234567890123456789012345678901234567890123456789012345678901234567890123456789x
0................................................................................|
1................................................................................|
2........................... ............................|
3........................... ...........................|
4........................... ...........................|
5.........................┌────────────────────────────┐.........................|
6.........................│ Abu.Dhabi is a.great.city! │ ........................|
7.........................│ ..... ...... .. │ ........................|
8.........................│ .... . ....<Quit> │ ........................|
9.........................└────────────────────────────┘ ........................|
0.......................... . ........................|
1........................... ...........................|
2........................... ...........................|
3........................... ...........................|
4............................ ...........................|
5................................................................................|
x--------------------------------------------------------------------------------x
test tests::displays ... ok
test tests::interacts ... ok
thread 'tests::control_chars_including_nul_when_on_screen' panicked at cursive/examples/select_test.rs:229:13:
assertion `left == right` failed: control chars \x8A thru \x93 should've been deleted from output
left: 0
right: 1
stack backtrace:
0: rust_begin_unwind
at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/std/src/panicking.rs:652:5
1: core::panicking::panic_fmt
at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/panicking.rs:72:14
2: core::panicking::assert_failed_inner
at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/panicking.rs:403:23
3: core::panicking::assert_failed
at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/panicking.rs:363:5
4: select_test::tests::control_chars_including_nul_when_on_screen
at ./examples/select_test.rs:229:13
5: select_test::tests::control_chars_including_nul_when_on_screen::{{closure}}
at ./examples/select_test.rs:129:52
6: core::ops::function::FnOnce::call_once
at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/ops/function.rs:250:5
7: core::ops::function::FnOnce::call_once
at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test tests::control_chars_including_nul_when_on_screen ... FAILED
failures:
failures:
tests::control_chars_including_nul_when_on_screen
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
error: test failed, to rerun pass `-p cursive --example select_test` basically if you see lots of dots in the last 2 screens, it means it didn't change what was there before, it seems. |
Whoops indeed the last commit wasn't pushed :-' |
I'll update in a sec, testing and such :) |
e50a2d8
to
4d0f5db
Compare
which would fail like this: test utils::lines::spans::tests::test_control_chars_have_width_1 ... FAILED failures: ---- utils::lines::spans::tests::test_control_chars_have_width_1 stdout ---- thread 'utils::lines::spans::tests::test_control_chars_have_width_1' panicked at /home/user/1tmp/ncurses_things/cursive/cursive-core/src/utils/lines/spans/tests.rs:55:9: assertion `left == right` failed: Width of control character \u{0000} is not 1 left: 0 right: 1 stack backtrace: 0: rust_begin_unwind at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5 1: core::panicking::panic_fmt at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14 2: core::panicking::assert_failed_inner at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:337:23 3: core::panicking::assert_failed at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:297:5 4: cursive_core::utils::lines::spans::tests::test_control_chars_have_width_1 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/macros/mod.rs:58:21 5: cursive_core::utils::lines::spans::tests::test_control_chars_have_width_1::{{closure}} at ./src/utils/lines/spans/tests.rs:32:37 6: core::ops::function::FnOnce::call_once at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5 7: core::ops::function::FnOnce::call_once at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. failures: utils::lines::spans::tests::test_control_chars_have_width_1 test result: FAILED. 29 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
... to work with unicode-width 0.1.12 as well. before this, because it was expecting only 0.1.13, it was failing with the following output: Running unittests examples/select_test.rs (target/x86_64-unknown-linux-gnu/debug/examples/select_test-d45f2e1e4022a737) running 4 tests captured piece: x01234567890123456789012345678901234567890123456789012345678901234567890123456789x 0 | 1 | 2 ┌┤ Where are you from? ├┐ | 3 │ Abidjan ▒ │ | 4 │ Abu Dhabi | │ | 5 │ Abuja | │ | 6 │ Accra | │ | 7 │ Adamstown | │ | 8 │ Addis Ababa | │ | 9 │ Algiers | │ | 0 │ Alofi | │ | 1 │ Amman | │ | 2 │ Amsterdam | │ | 3 └───────────────────────┘ | 4 | 5 | x--------------------------------------------------------------------------------x test tests::displays ... ok captured piece: x01234567890123456789012345678901234567890123456789012345678901234567890123456789x 0 | 1 | 2 ┌┤ Where are you from? ├┐ | 3 │ short nul 1str | │ | 4 │ 1thru8 | │ | 5 │ tabandnewline | │ | 6 │ bthru15 | │ | 7 │ 16thru1F | │ | 8 │ 7Fonly | │ | 9 │ 80thru89 | │ | 0 │ 8Athru93 | │ | 1 │ 94thru9D | │ | 2 │ 9Ethru9F ▒ │ | 3 └───────────────────────┘ | 4 | 5 | x--------------------------------------------------------------------------------x captured piece: x01234567890123456789012345678901234567890123456789012345678901234567890123456789x 0 | 1 | 2 ┌┤ Where are you from? ├┐ | 3 │ short nul 1str | │ | 4 │ 1thru8 | │ | 5 │ tabandnewline | │ | 6 │ bthru15 | │ | 7 │ 16thru1F | │ | 8 │ 7Fonly | │ | 9 │ 80thru89 | │ | 0 │ 8Athru93 | │ | 1 │ 94thru9D | │ | 2 │ 9Ethru9F ▒ │ | 3 └───────────────────────┘ | 4 | 5 | x--------------------------------------------------------------------------------x thread ' tests::control_chars_become_replacement_char' panicked at cursive/examples/select_test.rs:148:9: assertion `left == right` failed: tabs and newline should've been replaced with replacement char � aka \u{FFFD} left: 0 right: 1 stack backtrace: thread 'tests::nuls_become_replacement_char' panicked at cursive/examples/select_test.rs:133:9: assertion `left == right` failed: nuls aka \0 in strings are supposed to become the replacement char '�' left: 0 right: 1 captured piece: x01234567890123456789012345678901234567890123456789012345678901234567890123456789x 0 | 1 | 2 | 3 | 4 | 5 ┌────────────────────────────┐ | 6 │ Abu Dhabi is a great city! │ | 7 │ │ | 8 │ <Quit> │ | 9 └────────────────────────────┘ | 0 | 1 | 2 | 3 | 4 | 5 | x--------------------------------------------------------------------------------x test tests::interacts ... ok 0: rust_begin_unwind at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/std/src/panicking.rs:652:5 1: core::panicking::panic_fmt at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/panicking.rs:72:14 2: core::panicking::assert_failed_inner at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/panicking.rs:403:23 3: core::panicking::assert_failed at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/panicking.rs:363:5 4: select_test::tests::control_chars_become_replacement_char at ./examples/select_test.rs:148:9 5: select_test::tests::control_chars_become_replacement_char::{{closure}} at ./examples/select_test.rs:142:47 6: core::ops::function::FnOnce::call_once at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/ops/function.rs:250:5 7: core::ops::function::FnOnce::call_once at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/ops/function.rs:250:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. stack backtrace: 0: rust_begin_unwind at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/std/src/panicking.rs:652:5 1: core::panicking::panic_fmt at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/panicking.rs:72:14 2: core::panicking::assert_failed_inner at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/panicking.rs:403:23 3: core::panicking::assert_failed at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/panicking.rs:363:5 4: select_test::tests::nuls_become_replacement_char at ./examples/select_test.rs:133:9 5: select_test::tests::nuls_become_replacement_char::{{closure}} at ./examples/select_test.rs:128:38 6: core::ops::function::FnOnce::call_once at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/ops/function.rs:250:5 7: core::ops::function::FnOnce::call_once at /rustc/a70b2ae57713ed0e7411c059d582ab382fc4166a/library/core/src/ops/function.rs:250:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. test tests::control_chars_become_replacement_char ... FAILED test tests::nuls_become_replacement_char ... FAILED failures: failures: tests::control_chars_become_replacement_char tests::nuls_become_replacement_char test result: FAILED. 2 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s error: test failed, to rerun pass `-p cursive --example select_test`
because it will auto-show this output if it ever fails, if it doesn't fail, we don't need to see it, it's spammy
refers to the crate
closes #788
fixed a couple of nits too