rdumont / assistdog Goto Github PK
View Code? Open in Web Editor NEWUtility functions for using with Gherkin specs
License: MIT License
Utility functions for using with Gherkin specs
License: MIT License
Here is a list of them: https://go101.org/article/basic-types-and-value-literals.html
Hi @rdumont,
We're using assistdog here on CashCowPro. Thanks for it =)
We feel the need to add parsers for pointers, so we could handle nullable variables. Right now we're using N/A
to identify the nil. So our tables look like this:
Given we have the following products:
| Title | CreatedAt | UpdatedAt |
| Paladone Festive Photo Booth Game | 2017-12-16T00:00:00Z | 2017-12-17T00:00:00Z |
| N/A | 2017-12-18T00:00:00Z | N/A |
What do you think about this approach? I would be happy to raise an PR =]
If you want to take a look at our current implementation: https://github.com/cashcowpro/assistdog/pull/1/files
Thanks!
I've got a gherkin table like the following:
| ID | Name | Enabled |
| 1 | admin | true |
I've created a simple parser (and registered) for boolean. But in the code, when I have the following commands: table, err := assist.CreateSlice(Profile{}, profiles)
I'm getting the error:
reflect: Elem of invalid type
runtime.call64
/usr/local/go/src/runtime/asm_amd64.s:523
runtime.gopanic
/usr/local/go/src/runtime/panic.go:513
reflect.(*rtype).Elem
/usr/local/go/src/reflect/type.go:923
github.com/rdumont/assistdog.(*Assist).createInstance
github.com/rdumont/assistdog/assist.go:226
github.com/rdumont/assistdog.(*Assist).CreateSlice
github.com/rdumont/assistdog/assist.go:166
For instance, given the following step definition:
func (s *Steps) ThenTheReturnedErrorsShouldBe(errorsTbl *godog.Table) error {
actualResponse := []*struct {
Code int
Description string
}{
{Code: 123, Description: "Only one error"}, // <-- Only one element here
}
if err := assitdog.NewDefault().CompareToSlice(actualResponse, errorsTbl); err != nil {
return fmt.Errorf("return errors are different from expected: %v", err)
}
return nil
}
And the following step in a scenario:
Then the returned errors should be
| Code | Description |
| 123 | First error |
| 456 | Second error |
I would expect to see an error stating that the number of elements is different. However, I got a panic like the following:
panic: reflect: slice index out of range
goroutine 100 [running]:
testing.tRunner.func1.1(0x15b0220, 0x1727ba0)
/usr/local/Cellar/go/1.15.5/libexec/src/testing/testing.go:1072 +0x30d
testing.tRunner.func1(0xc000316a80)
/usr/local/Cellar/go/1.15.5/libexec/src/testing/testing.go:1075 +0x41a
panic(0x15b0220, 0x1727ba0)
/usr/local/Cellar/go/1.15.5/libexec/src/runtime/panic.go:969 +0x1b9
reflect.Value.Index(0x15a4da0, 0xc000153e00, 0x97, 0x1, 0x1a8bfe0, 0x0, 0x0)
/usr/local/Cellar/go/1.15.5/libexec/src/reflect/value.go:962 +0x1f2
github.com/rdumont/assistdog.(*Assist).CompareToSlice(0xc0003054a0, 0x15a4da0, 0xc000153e00, 0xc00031c7a0, 0x0, 0x0)
/Users/rodrigodumont/go/pkg/mod/github.com/rdumont/[email protected]/assist.go:212 +0x197
When in strict mode, a field that does not exist in the given type will cause an error. Otherwise, it will simply be ignored.
Variations of case and word spacing should be disregarded when looking for fields. For instance, both First Name
, firstname
, first Name
should match field FirstName
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.