Skip to content
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

Please clarify: type of table cells #55

Closed
pcn opened this issue Jun 20, 2020 · 5 comments · Fixed by #132
Closed

Please clarify: type of table cells #55

pcn opened this issue Jun 20, 2020 · 5 comments · Fixed by #132
Assignees
Labels
k::documentation Related to project documentation
Milestone

Comments

@pcn
Copy link

pcn commented Jun 20, 2020

There is an example of tables, but the example infers the type from cucumber's step, and doesn't describe whether there is any way to specify the desired type in either the test or the feature file.

@pcn
Copy link
Author

pcn commented Jul 6, 2020

So it's defined in gherkin-rust as:

/// A data table
#[derive(Debug, Clone, TypedBuilder, PartialEq, Hash, Eq)]
pub struct Table {
    /// The rows of the data table. Each row is always the same length as the first row.
    pub rows: Vec<Vec<String>>,
    /// The `(start, end)` offset the table directive was found in the .feature file.
    #[builder(default)]
    pub span: (usize, usize),
    /// The `(line, col)` position the table directive was found in the .feature file.
    #[builder(default)]
    pub position: (usize, usize),
}

impl Table {
    pub fn row_width(&self) -> usize {
        self.rows
            .iter()
            .next()
            .map(|x| x.len())
            .unwrap_or_else(|| 0)
    }
}

It'd still be helpful to have some examples of how it's best to use it, for us noobs.

@bbqsrc
Copy link
Member

bbqsrc commented Jul 6, 2020

Ah, sorry I didn't get to this sooner!

Indeed, documentation on things like table usage is indeed lacking at the moment, though a lot of that perhaps comes from my historical lack of confidence in its implementation. 😄

Will put out a new release soon that is in many ways a bit more of a blank slate, with integration of first-class async support as a core deliverable, and the removal of the cucumber! macro, so I'll hopefully get to documenting some table patterns when I get there.

Thanks for persevering, I hope to make it easier to contribute soon. 👍

@bbqsrc bbqsrc added the k::documentation Related to project documentation label Jul 6, 2020
@pcn
Copy link
Author

pcn commented Jul 15, 2020

Gotcha. Looking forward the the future.

@tyranron tyranron added this to the 0.10 milestone Sep 28, 2021
@tyranron
Copy link
Member

@ilslv let's document this one too before releasing 0.10.

tyranron added a commit that referenced this issue Sep 30, 2021
, #64, #102, #103, #123, #132)

Additionally:
- fix outputing English in writer::Basic instead of parsed keywords

Co-authored-by: Kai Ren <tyranron@gmail.com>
@tyranron
Copy link
Member

Now described in "Features" chapter of the Book.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k::documentation Related to project documentation
Projects
None yet
4 participants