Comments (11)
I can't seem to reproduce this. Because your feature is in Norwegian, Cuucmber uses the no
locale.
So you should be able to run this without any problems:
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
public class LocaleTest {
public static void main(String[] args) throws ParseException {
Locale locale = Locale.forLanguageTag("no");
NumberFormat format = DecimalFormat.getNumberInstance(locale);
Number parsed = format.parse("-2,11");
System.out.println(parsed);
}
}
Which leads me to think that perhaps your editor replaced -
(ascii 45) with something else.
To debug this, you can put a breakpoint in the NumberParser.parseFloat
method, and look at the code points in the string.
Btw, using double
for money is not recommended. Either use a dedicated money type or BigDecimal
to avoid rounding errors.
from cucumber-expressions.
No, it's definitely ASCII 45. The entire string is [45, 50, 44, 49, 49]
when viewing it in the debugger.
I noticed that when using the debugger to feed a unicode minus sign (U+2212) to numberFormat.parse
instead, it sucessfully parses the number.
from cucumber-expressions.
Mmh. I tested this on 8.0.352-zulu
. Which JVM are you using?
from cucumber-expressions.
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)
from cucumber-expressions.
Looks like a variation of https://bugs.openjdk.org/browse/JDK-8298849.
For my Native dutch the hypen is used. Do Norwegian keyboards have a dedicated key for the minus sign or is that just the hypen?
from cucumber-expressions.
No, it's impossible to type the minus sign using any sane method. Everyone just uses the normal hyphen (ascii 45).
from cucumber-expressions.
Oh that is just lovely. This also applies to:
Northern Sami (Latin, Norway)
Northern Sami (Norway)
Norwegian Bokmål (Svalbard & Jan Mayen)
Basque
Persian
Croatian (Latin, Croatia)
Norwegian
Swiss German
Norwegian (Latin, Norway)
Slovenian
Swiss German (France)
Estonian (Estonia)
Slovenian (Slovenia)
Finnish (Latin, Finland)
Norwegian Bokmål (Norway)
Persian (Arabic, Iran)
Finnish (Finland)
Colognian (Germany)
Romansh (Latin, Switzerland)
Norwegian (Norway)
Lithuanian (Lithuania)
Colognian (Latin, Germany)
Croatian (Croatia)
Slovenian (Latin, Slovenia)
Croatian
Lithuanian
Swiss German (Liechtenstein)
Croatian (Bosnia & Herzegovina)
Swedish (Sweden)
Persian (Afghanistan)
Swedish
Basque (Latin, Spain)
Swedish (Latin, Sweden)
Persian (Iran)
Swedish (Finland)
Faroese (Latin, Faroe Islands)
Colognian
Swiss German (Switzerland)
Estonian
Finnish
Romansh
Norwegian Bokmål (Latin, Norway)
Romansh (Switzerland)
Estonian (Latin, Estonia)
Northern Sami (Finland)
Lithuanian (Latin, Lithuania)
Northern Sami (Sweden)
Northern Sami
Faroese (Denmark)
Faroese (Faroe Islands)
Faroese
Basque (Spain)
Swiss German (Latin, Switzerland)
Swedish (Åland Islands)
So I'm half minded to override the minus sign to a dash when it is used.
from cucumber-expressions.
That will probably work. It looks like it needs to be a hyphen in order to be recognized as a parameter anyway, i.e., replacing the hyphen with a unicode minus in the Gherkin file doesn't work.
from cucumber-expressions.
Cheers good point.
I presume you also don't use a non-breaking space to separate thousands?
from cucumber-expressions.
I presume you also don't use a non-breaking space to separate thousands?
That's correct, it has the same problem with not being possible to type on a keyboard, so only the most techically minded people will use it in practice. Using a regular space isn't uncommon, though, as is using a period.
from cucumber-expressions.
Thanks for the explanation.
The fix should be in the latest version of cucumber-jvm
.
from cucumber-expressions.
Related Issues (20)
- Remove Python example illustrating how to define parameter types HOT 2
- more powerful optional text HOT 12
- Allow free-form text in optionals HOT 1
- Expression for an argument list HOT 4
- Improve Expression creation performance HOT 2
- Use action-publish-pypi in cucumber-expressions
- Optimize Cucumber expression creation in .Net implementation
- Action Required: Fix Renovate Configuration
- Bad CucumberExpression creation performance HOT 6
- Golang big.Float is not a big decimal HOT 12
- Feature: named capture groups HOT 13
- Missing source for source map
- RegEx "expressions" and defineParameterType feature file examples ?
- Add the ability to ignore a cucumber expression parameter just like a non capturing regex HOT 12
- Nested capture groups are not passed to custom param definition transformer HOT 8
- `end` as a method name / prop can cause some issues HOT 4
- LICENSE file is empty HOT 1
- Typo in error message for use of alternation inside an optional
- Released Ruby gem is missing LICENSE file. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cucumber-expressions.