Skip to content

Commit ffc9fbb

Browse files
committedMar 16, 2021
Add a simple test for CLibrary.setenv/chdir
1 parent 35bd6b5 commit ffc9fbb

File tree

2 files changed

+60
-3
lines changed

2 files changed

+60
-3
lines changed
 

‎pom.xml

+18-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
<description>Jansi is a java library for generating and interpreting ANSI escape sequences.</description>
3333

3434
<properties>
35+
<javadocSource>6</javadocSource>
36+
<jdkTarget>1.7</jdkTarget>
3537
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3638
<slf4j-version>1.6.1</slf4j-version>
3739
<project.build.outputTimestamp>2021-02-11T16:12:43Z</project.build.outputTimestamp>
@@ -149,8 +151,8 @@
149151
<version>3.8.1</version>
150152
<configuration>
151153
<!-- parent pom 1.11 forces version instead of using property -->
152-
<source>1.6</source>
153-
<target>1.6</target>
154+
<source>${jdkTarget}</source>
155+
<target>${jdkTarget}</target>
154156
</configuration>
155157
</plugin>
156158
<plugin>
@@ -252,7 +254,7 @@
252254
<version>false</version>
253255
<author>true</author>
254256
<keywords>true</keywords>
255-
<source>6</source>
257+
<source>${javadocSource}</source>
256258
</configuration>
257259
<executions>
258260
<execution>
@@ -334,4 +336,17 @@
334336
</dependency>
335337
</dependencies>
336338

339+
<profiles>
340+
<profile>
341+
<id>jdk15+</id>
342+
<activation>
343+
<jdk>[15,)</jdk>
344+
</activation>
345+
<properties>
346+
<jdkTarget>1.7</jdkTarget>
347+
<javadocSource>7</javadocSource>
348+
</properties>
349+
</profile>
350+
</profiles>
351+
337352
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (C) 2009-2021 the original author(s).
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.fusesource.jansi.internal;
17+
18+
import java.io.File;
19+
20+
import org.junit.jupiter.api.Test;
21+
import org.junit.jupiter.api.condition.DisabledOnJre;
22+
import org.junit.jupiter.api.condition.DisabledOnOs;
23+
import org.junit.jupiter.api.condition.JRE;
24+
import org.junit.jupiter.api.condition.OS;
25+
26+
@DisabledOnOs(OS.WINDOWS)
27+
@DisabledOnJre({JRE.JAVA_15, JRE.JAVA_16})
28+
public class CLibraryTest {
29+
30+
@Test
31+
void testChdir() {
32+
File d = new File("target/tstDir");
33+
d.mkdirs();
34+
CLibrary.chdir(d.getAbsolutePath());
35+
}
36+
37+
@Test
38+
void testSetenv() {
39+
CLibrary.setenv("MY_NAME", "myValue");
40+
}
41+
42+
}

0 commit comments

Comments
 (0)
Please sign in to comment.