Skip to content

Cucumber Expression Parsing Error for Float Type #197

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

Closed
jcsho opened this issue Jan 10, 2022 · 2 comments · Fixed by cucumber-rs/cucumber-expressions#6
Closed

Cucumber Expression Parsing Error for Float Type #197

jcsho opened this issue Jan 10, 2022 · 2 comments · Fixed by cucumber-rs/cucumber-expressions#6

Comments

@jcsho
Copy link

jcsho commented Jan 10, 2022

Setup

Feature

Scenario: A tuple with w=0 is a vector
  Given a ← tuple(4.3, -4.2, 3.1, 0.0)

Code

#[given(expr = "a ← tuple\\({float}, {float}, {float}, {float})")]
fn setup_tuple(world: &mut TupleWorld, x: f64, y: f64, z: f64, w: f64) {
  ...
}

Error

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Regex(Syntax(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
regex parse error:
    ^a ← tuple\(((?=.*\d.*)[-+]?\d*(?:\.(?=\d.*))?\d*(?:\d+[E][+-]?\d+)?), ((?=.*\d.*)[-+]?\d*(?:\.(?=\d.*))?\d*(?:\d+[E][+-]?\d+)?), ((?=.*\d.*)[-+]?\d*(?:\.(?=\d.*))?\d*(?:\d+[E][+-]?\d+)?), ((?=.*\d.*)[-+]?\d*(?:\.(?=\d.*))?\d*(?:\d+[E][+-]?\d+)?)\)$
                 ^^^
error: look-around, including look-ahead and look-behind, is not supported
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
))', tests/tuples.rs:26:1
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:100:14
   2: core::result::unwrap_failed
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/result.rs:1616:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/result.rs:1298:23
   4: tuples::_::__init::__INVENTORY::{{closure}}::LAZY::{{closure}}
             at ./tests/tuples.rs:26:1
   5: core::ops::function::FnOnce::call_once
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227:5
   6: core::ops::function::FnOnce::call_once
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227:5
   7: once_cell::sync::Lazy<T,F>::force::{{closure}}
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.9.0/src/lib.rs:1163:28
   8: once_cell::sync::OnceCell<T>::get_or_init::{{closure}}
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.9.0/src/lib.rs:974:57
   9: once_cell::imp::OnceCell<T>::initialize::{{closure}}
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.9.0/src/imp_pl.rs:64:19
  10: once_cell::imp::initialize_inner
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.9.0/src/imp_pl.rs:122:12
  11: once_cell::imp::OnceCell<T>::initialize
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.9.0/src/imp_pl.rs:54:9
  12: once_cell::sync::OnceCell<T>::get_or_try_init
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.9.0/src/lib.rs:1014:13
  13: once_cell::sync::OnceCell<T>::get_or_init
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.9.0/src/lib.rs:974:19
  14: once_cell::sync::Lazy<T,F>::force
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.9.0/src/lib.rs:1162:13
  15: <once_cell::sync::Lazy<T,F> as core::ops::deref::Deref>::deref
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.9.0/src/lib.rs:1172:13
  16: tuples::_::__init::__INVENTORY::{{closure}}
             at ./tests/tuples.rs:26:1
  17: core::ops::function::FnOnce::call_once
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227:5
  18: cucumber::codegen::WorldInit::collection
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/cucumber-0.11.1/src/codegen.rs:42:40
  19: cucumber::codegen::WorldInit::cucumber
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/cucumber-0.11.1/src/codegen.rs:61:31
  20: cucumber::codegen::WorldInit::run::{{closure}}
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/cucumber-0.11.1/src/codegen.rs:80:9
  21: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/future/mod.rs:80:19
  22: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/future/future.rs:119:9
  23: futures_executor::local_pool::block_on::{{closure}}
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.19/src/local_pool.rs:315:23
  24: futures_executor::local_pool::run_executor::{{closure}}
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.19/src/local_pool.rs:90:37
  25: std::thread::local::LocalKey<T>::try_with
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/thread/local.rs:399:16
  26: std::thread::local::LocalKey<T>::with
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/thread/local.rs:375:9
  27: futures_executor::local_pool::run_executor
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.19/src/local_pool.rs:86:5
  28: futures_executor::local_pool::block_on
             at /Users/jcsho/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.19/src/local_pool.rs:315:5
  29: tuples::main
             at ./tests/tuples.rs:44:5
  30: core::ops::function::FnOnce::call_once
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Seems to work fine with the {int} type.

@tyranron
Copy link
Member

@jcsho cargo update -p cucumber-expressions should solve your problem now.

@jcsho
Copy link
Author

jcsho commented Jan 12, 2022

amazing! thanks for the quick fix 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants