You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define biginteger, bigdecimal, byte, short, long, double for all implementations (#42)
* Extract ParameterTypeRegistry#defineDefaultParameterTypes()
* Linting
* Extract defineDefaultParameterTypes
* linting
* Rename test, fix imports
* Add test to match big decimal
* Add bigdecimal test
* Make javascript tests pass
* Add BigDecimal support in Ruby
* Add 1024 bit bigdecimal in go
* Implement {biginteger} on all implementations
* Add support for byte
* Support remaining types
* Remove conditional definition of types
* Update docs
* Add unit test
* Update java/src/test/java/io/cucumber/cucumberexpressions/CucumberExpressionTest.java
Co-authored-by: Aurélien Reeves <[email protected]>
Co-authored-by: Aurélien Reeves <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,20 +52,22 @@ the following built-in parameter types:
52
52
53
53
| Parameter Type | Description |
54
54
| --------------- | ----------- |
55
-
|`{int}`| Matches integers, for example `71` or `-19`. |
56
-
|`{float}`| Matches floats, for example `3.6`, `.8` or `-9.2`. |
55
+
|`{int}`| Matches integers, for example `71` or `-19`. Converts to a 32-bit signed integer if the platform supports it.|
56
+
|`{float}`| Matches floats, for example `3.6`, `.8` or `-9.2`. Converts to a 32 bit float if the platform supports it. |
57
57
|`{word}`| Matches words without whitespace, for example `banana` (but not `banana split`). |
58
58
|`{string}`| Matches single-quoted or double-quoted strings, for example `"banana split"` or `'banana split'` (but not `banana split`). Only the text between the quotes will be extracted. The quotes themselves are discarded. Empty pairs of quotes are valid and will be matched and passed to step code as empty strings. |
59
59
|`{}` anonymous | Matches anything (`/.*/`). |
60
+
|`{bigdecimal}`| Matches the same as `{float}`, but converts to a `BigDecimal` if the platform supports it. |
61
+
|`{double}`| Matches the same as `{float}`, but converts to a 64 bit float if the platform supports it. |
62
+
|`{biginteger}`| Matches the same as `{int}`, but converts to a `BigInteger` if the platform supports it. |
63
+
|`{byte}`| Matches the same as `{int}`, but converts to an 8 bit signed integer if the platform supports it. |
64
+
|`{short}`| Matches the same as `{int}`, but converts to a 16 bit signed integer if the platform supports it. |
65
+
|`{long}`| Matches the same as `{int}`, but converts to a 64 bit signed integer if the platform supports it. |
60
66
61
-
### Cucumber-JVM additions
67
+
### Cucumber-JVM
62
68
63
-
On the JVM, there are additional parameter types for `biginteger`, `bigdecimal`,
64
-
`byte`, `short`, `long` and `double`.
65
-
66
-
The anonymous parameter type will be converted to the parameter type of the step definition using an object mapper.
67
-
Cucumber comes with a built-in object mapper that can handle most basic types. Aside from `Enum` it supports conversion
68
-
to `BigInteger`, `BigDecimal`, `Boolean`, `Byte`, `Short`, `Integer`, `Long`, `Float`, `Double` and `String`.
69
+
The *anonymous* parameter type will be converted to the parameter type of the step definition using an object mapper.
70
+
Cucumber comes with a built-in object mapper that can handle all numeric types as well as. `Enum`.
69
71
70
72
To automatically convert to other types it is recommended to install an object mapper. See [configuration](https://cucumber.io/docs/cucumber/configuration)
71
73
to learn how.
@@ -153,7 +155,7 @@ public Color ConvertColor(string colorValue)
153
155
}
154
156
```
155
157
156
-
*Note: Currently the parameter name cannot be customized, so the custom paramters can only be used with the type name, e.g. `{Color}`.*
158
+
*Note: Currently the parameter name cannot be customized, so the custom parameters can only be used with the type name, e.g. `{Color}`.*
0 commit comments