Panic when running `test` with an empty argument
Created by: pengowen123
Reproduction:
Run test
with an empty argument, for example: test ''
or test 'c' = ''
.
Expected behavior:
In the first example, return false, because the default operation is -n
, and the length of ''
is zero. In the second example, return false, because 'c' != ''
.
Actual behavior:
Ion panics with called 'Option::unwrap()' on a
None value
.
Build information:
rustc -V
: rustc 1.20.0-nightly (720c596ec 2017-07-08)
git rev-parse HEAD
: 7598290ed62788fc88cac14b7a42b8f0beef360b
uname -a
: Linux arch-pc 4.11.9-1-ARCH #1 SMP PREEMPT Wed Jul 5 18:23:08 CEST 2017 x86_64 GNU/Linux
Misc:
With RUST_BACKTRACE=full
:
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335
stack backtrace:
0: 0x557b72279d53 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::hcab99e0793da62c7
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: 0x557b72276a3e - std::panicking::default_hook::{{closure}}::h9ba2c6973907a2be
at /checkout/src/libstd/sys_common/backtrace.rs:71
at /checkout/src/libstd/sys_common/backtrace.rs:60
at /checkout/src/libstd/panicking.rs:355
2: 0x557b72275cac - std::panicking::rust_panic_with_hook::ha138c05cd33ad44d
at /checkout/src/libstd/panicking.rs:371
at /checkout/src/libstd/panicking.rs:549
3: 0x557b722757d1 - std::panicking::begin_panic::hcdbfa35c94142fa2
at /checkout/src/libstd/panicking.rs:511
4: 0x557b72275719 - std::panicking::begin_panic_fmt::hc09fe500d9b7be81
at /checkout/src/libstd/panicking.rs:495
5: 0x557b72289976 - core::panicking::panic_fmt::h883a028e9f4b4457
at /checkout/src/libstd/panicking.rs:471
6: 0x557b7228b77d - core::panicking::panic::hdb3cf3207dda37bb
at /checkout/src/libcore/panicking.rs:49
7: 0x557b72211f5c - ion::builtins::Builtin::map::{{closure}}::hc1be3aa2f15261fd
at /checkout/src/libcore/macros.rs:21
at src/builtins/test.rs:131
at src/builtins/test.rs:119
at src/builtins/mod.rs:308
8: 0x557b72235af3 - ion::shell::Shell::run_pipeline::hd28d363ed5218cbf
at src/shell/mod.rs:428
9: 0x557b72226cd5 - <ion::shell::Shell<'a> as ion::shell::flow::FlowLogic>::execute_toplevel::h4d7226357477a69a
at src/shell/flow.rs:501
10: 0x557b7221f604 - <ion::shell::Shell<'a> as ion::shell::flow::FlowLogic>::on_command::hdb239d7f02639432
at src/shell/flow.rs:59
11: 0x557b7223fa94 - ion::inner_main::h8c7d6f69a9ad9a2a
at src/shell/mod.rs:237
at src/shell/mod.rs:265
at src/shell/mod.rs:306
at src/main.rs:72
12: 0x557b721c6157 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3c92254b3bc9f75f
at src/main.rs:79
at /checkout/src/libstd/sys_common/backtrace.rs:136
13: 0x557b721d2e79 - <F as alloc::boxed::FnBox<A>>::call_box::h1afea58dda005ae1
at /checkout/src/libstd/thread/mod.rs:364
at /checkout/src/libstd/panic.rs:296
at /checkout/src/libstd/panicking.rs:454
at /checkout/src/libpanic_abort/lib.rs:40
at /checkout/src/libstd/panic.rs:361
at /checkout/src/libstd/thread/mod.rs:363
at /checkout/src/liballoc/boxed.rs:648
14: 0x557b72286b63 - std::sys::imp::thread::Thread::new::thread_start::h227b2afaa9316a8d
at /checkout/src/liballoc/boxed.rs:658
at /checkout/src/libstd/sys_common/thread.rs:21
at /checkout/src/libstd/sys/unix/thread.rs:84
15: 0x7f6416557296 - start_thread
16: 0x7f64160811ee - clone
17: 0x0 - <unknown>
ion: process ended by signal