RUBY-23469 follow-up: use the second one of the official regexps

This commit is contained in:
Anton Lobov
2019-02-04 14:12:15 +01:00
parent 5a69eb809f
commit e6e0952c82
2 changed files with 9 additions and 2 deletions
@@ -145,7 +145,7 @@ public class YamlGenericValueAdapter implements JsonValueAdapter {
private static boolean isFloat(@NotNull String s) {
if (INFS.contains(trimSign(s)) || NANS.contains(s)) return true;
if (hasTag(s, "float")) return true;
return Pattern.matches("[-+]?[1-9](\\.[0-9]*[1-9])?([eE][-+]?[1-9][0-9]*)?", s);
return Pattern.matches("[-+]?(\\.[0-9]+|[0-9]+(\\.[0-9]*)?)([eE][-+]?[0-9]+)?", s);
}
@NotNull
@@ -796,10 +796,17 @@ public class YamlByJsonSchemaHighlightingTest extends JsonSchemaHighlightingTest
public void testTravisPythonVersion() throws Exception {
@Language("JSON") String schema = FileUtil.loadFile(new File(getTestDataPath() + "/travis.schema.json"));
doTest(schema, "python: 3.5"); // validates as 'number'
doTest(schema, "python: 3.50"); // validates as 'string'
doTest(schema, "python: 3.50"); // validates as 'number'
doTest(schema, "python: 3.50a"); // validates as 'string'
doTest(schema, "python: <warning descr=\"Schema validation: Type is not allowed. Expected one of: array, number, string.\">null</warning>");
}
public void testTravisNode() throws Exception {
@Language("JSON") String schema = FileUtil.loadFile(new File(getTestDataPath() + "/travis.schema.json"));
doTest(schema, "node_js: \n" +
" - <warning descr=\"Schema validation: Type is not allowed. Expected: string.\">2.10</warning>");
}
public void testExpNumberNotation() throws Exception {
doTest("{\n" +
" \"properties\": {\n" +