// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.commandInterface.commandLine; import com.intellij.commandInterface.command.*; import com.intellij.commandInterface.commandLine.psi.CommandLineFile; import com.intellij.openapi.Disposable; import com.intellij.openapi.util.Pair; import com.intellij.testFramework.fixtures.CodeInsightTestFixture; import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl; import com.jetbrains.python.PythonTestUtil; import org.easymock.EasyMock; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.TestOnly; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * Shared tools to testing command line * * @author Ilya.Kazakevich */ final class CommandTestTools { @NotNull static final String TEST_PATH = PythonTestUtil.getTestDataPath() + "/commandLine/"; private CommandTestTools() { } /** *
command --available-option=available_argument --option-no-argument positional_argument
* * @return list cosists of fake command with opts and arguments */ @TestOnly @NotNull static List createCommands() { //command positional_argument --available-option=available_argument final Command command = EasyMock.createMock(Command.class); EasyMock.expect(command.getName()).andReturn("command").anyTimes(); EasyMock.expect(command.getHelp(true)).andReturn(new Help("some_text")).anyTimes(); EasyMock.expect(command.getHelp(false)).andReturn(new Help("some_text")).anyTimes(); final List