Skip to content

Commit

Permalink
Use JUnit 4 only.
Browse files Browse the repository at this point in the history
  • Loading branch information
toinehartman committed Jul 3, 2024
1 parent b32a284 commit 2bcf7ae
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
28 changes: 8 additions & 20 deletions rascal-lsp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<version>2.20.2-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.10.3</junit.version>
<junit.version>4.13.1</junit.version>
<maven-surefire-plugin.version>3.3.0</maven-surefire-plugin.version>
<log4j2.version>2.23.1</log4j2.version>
<lsp4j.version>0.23.1</lsp4j.version>
Expand Down Expand Up @@ -75,29 +75,10 @@
<artifactId>typepal</artifactId>
<version>0.13.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Rascal tests require JUnit 4 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<!-- Required to run JUnit 4 and 5 tests in the same test run -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -174,6 +155,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>3.3.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.rascalmpl</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;
import org.junit.Test;
import org.rascalmpl.vscode.lsp.util.locations.LineColumnOffsetMap;
import org.rascalmpl.vscode.lsp.util.locations.impl.ArrayLineOffsetMap;

public class LineColumnOffsetMapTests {
@Test
void noUnicodeChars() {
public void noUnicodeChars() {
LineColumnOffsetMap map = ArrayLineOffsetMap.build("1234\n1234");
assertEquals(2, map.translateColumn(0, 2, false));
}

@Test
void singleWideChar() {
public void singleWideChar() {
LineColumnOffsetMap map = ArrayLineOffsetMap.build("12🎉45\n1234🎉");
assertEquals(3, map.translateColumn(0, 3, false));
assertEquals(4, map.translateColumn(0, 3, true));
Expand All @@ -49,21 +49,21 @@ void singleWideChar() {


@Test
void doubleChars() {
public void doubleChars() {
LineColumnOffsetMap map = ArrayLineOffsetMap.build("12🎉4🎉6\n1234");
assertEquals(6, map.translateColumn(0, 5, false));
assertEquals(7, map.translateColumn(0, 5, true));
assertEquals(8, map.translateColumn(0, 6, false));
}

@Test
void noUnicodeCharsInverse() {
public void noUnicodeCharsInverse() {
LineColumnOffsetMap map = ArrayLineOffsetMap.build("1234\n1234");
assertEquals(2, map.translateInverseColumn(0, 2, false));
}

@Test
void singleWideCharInverse() {
public void singleWideCharInverse() {
LineColumnOffsetMap map = ArrayLineOffsetMap.build("12🎉45\n1234🎉");
assertEquals(3, map.translateInverseColumn(0, 3, false));
assertEquals(3, map.translateInverseColumn(0, 4, false));
Expand All @@ -72,7 +72,7 @@ void singleWideCharInverse() {


@Test
void doubleCharsInverse() {
public void doubleCharsInverse() {
LineColumnOffsetMap map = ArrayLineOffsetMap.build("12🎉4🎉6\n1234");
assertEquals(5, map.translateInverseColumn(0, 6, false));
assertEquals(5, map.translateInverseColumn(0, 7, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
*/
package engineering.swat.rascal.lsp.util;

import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.Assert.assertSame;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.Range;
import org.junit.jupiter.api.Test;
import org.junit.Test;
import org.rascalmpl.vscode.lsp.util.locations.impl.TreeMapLookup;

public class LookupTests {
Expand Down Expand Up @@ -157,7 +158,7 @@ public void randomRanges() {
ranges.forEach(target::put);
for (var e: ranges.entrySet()) {
var found = target.lookup(e.getKey());
assertSame(e.getValue(), found, "Entry " + e + "should be found");
assertSame("Entry " + e + "should be found", e.getValue(), found);
}
}

Expand Down

0 comments on commit 2bcf7ae

Please sign in to comment.