PakhomovAlexander commented on code in PR #4323:
URL: https://github.com/apache/ignite-3/pull/4323#discussion_r1742559387
##########
modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/treesitter/highlighter/HighlighterTest.java:
##########
@@ -21,34 +21,34 @@
import static org.junit.jupiter.params.provider.Arguments.of;
import java.util.stream.Stream;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
/**
* Tests for the highlighting errors in JSON text. The colors itself are not
tested.
*/
-class JsonAnsiHighlighterTest {
- JsonAnsiHighlighter highlighter;
+class HighlighterTest {
- private static Stream<Arguments> textInput() {
+ private static Stream<Arguments> jsonTextInput() {
return Stream.of(
of("plain", "plain"),
of("{\"key\": \"val\"}", "{\"key\": \"val\"}"),
of("{\"key\": \"1%\"}", "{\"key\": \"1%\"}")
);
}
- @BeforeEach
- void setUp() {
- highlighter = new JsonAnsiHighlighter();
+ @ParameterizedTest
+ @MethodSource("jsonTextInput")
+ void jsonHighlight(String input, String expected) {
+ String result = JsonAnsiHighlighter.highlight(input);
+ assertEquals(expected, result);
}
@ParameterizedTest
- @MethodSource("textInput")
- void testHighlight(String input, String expected) {
- String result = highlighter.highlight(input);
+ @MethodSource("jsonTextInput")
+ void hoconHighlight(String input, String expected) {
Review Comment:
can you add one more MethodSource for hocon test case? It would be nice to
test not only json input but hocon too.
##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/FormatMixin.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.cli.commands;
+
+import static
org.apache.ignite.internal.cli.commands.Options.Constants.CONFIG_FORMAT_OPTION;
+import static
org.apache.ignite.internal.cli.commands.Options.Constants.CONFIG_FORMAT_OPTION_DESC;
+import static picocli.CommandLine.Help.Visibility.ALWAYS;
+
+import jakarta.inject.Inject;
+import org.apache.ignite.internal.cli.call.configuration.JsonString;
+import org.apache.ignite.internal.cli.config.CliConfigKeys;
+import org.apache.ignite.internal.cli.config.ConfigManagerProvider;
+import org.apache.ignite.internal.cli.core.decorator.Decorator;
+import org.apache.ignite.internal.cli.core.decorator.TerminalOutput;
+import org.apache.ignite.internal.cli.decorators.HoconDecorator;
+import org.apache.ignite.internal.cli.decorators.JsonDecorator;
+import picocli.CommandLine.Option;
+
+/** Mixin for json format option. */
Review Comment:
```suggestion
/** Mixin for config format option. */
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]