File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ package processing.app
2
+
3
+ import java.io.File
4
+ import kotlin.test.Test
5
+
6
+ /*
7
+ This class is used to test the CLI commands of the Processing IDE.
8
+ It mostly exists to quickly run CLI commands without having to specify run configurations
9
+ or to manually run it on the command line.
10
+
11
+ In IntelliJ IDEA, it should display runnable arrows next to each test method.
12
+ Use this to quickly test the CLI commands.
13
+ The output will be displayed in the console after `Running CLI with arguments: ...`.
14
+ When developing on the CLI commands, feel free to add more test methods here.
15
+ */
16
+ class CLITest {
17
+
18
+ @Test
19
+ fun testLSP (){
20
+ runCLIWithArguments(" lsp" )
21
+ }
22
+
23
+ @Test
24
+ fun testLegacyCLI (){
25
+ runCLIWithArguments(" cli --help" )
26
+ }
27
+
28
+ /*
29
+ This function runs the CLI with the given arguments.
30
+ */
31
+ fun runCLIWithArguments (args : String ) {
32
+ // TODO: Once Processing PDE correctly builds in IntelliJ IDEA switch over to using the code directly
33
+ // To see if the PDE builds correctly can be tested by running the Processing.kt main function directly in IntelliJ IDEA
34
+ // Set the JAVA_HOME environment variable to the JDK used by the IDE
35
+ println (" Running CLI with arguments: $args " )
36
+ val process = ProcessBuilder (" ./gradlew" , " run" , " --args=$args " , " --quiet" )
37
+ .directory(File (System .getProperty(" user.dir" )).resolve(" ../../../" ))
38
+ .inheritIO()
39
+
40
+ process.environment().apply {
41
+ put(" JAVA_HOME" , System .getProperty(" java.home" ))
42
+ }
43
+
44
+ val result = process
45
+ .start()
46
+ .waitFor()
47
+ println (" Done running CLI with arguments: $args (Result: $result )" )
48
+
49
+ }
50
+ }
You can’t perform that action at this time.
0 commit comments