Add emptyTest
This commit is contained in:
parent
690901fd8b
commit
68bf49f639
77
src/test/java/app/model/languages/EmptyTest.java
Normal file
77
src/test/java/app/model/languages/EmptyTest.java
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package app.model.languages;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import app.model.ProgrammingLanguage;
|
||||||
|
|
||||||
|
public class EmptyTest {
|
||||||
|
|
||||||
|
private ProgrammingLanguage lang = new Empty();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test commentLine")
|
||||||
|
public void testCommentLine() {
|
||||||
|
String line = "test";
|
||||||
|
|
||||||
|
assertEquals(line, lang.commentLine(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test unCommentLine")
|
||||||
|
public void testUnCommentLine() {
|
||||||
|
String line = "test";
|
||||||
|
|
||||||
|
assertEquals(line, lang.unCommentLine("test"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test combination of commentLine and unCommentLine")
|
||||||
|
public void testCommentUnCommentLine() {
|
||||||
|
String line = "test";
|
||||||
|
String wrapped1 = lang.unCommentLine(lang.commentLine(line));
|
||||||
|
String wrapped2 = lang.unCommentLine(lang.commentLine(wrapped1));
|
||||||
|
|
||||||
|
assertEquals(line, wrapped1);
|
||||||
|
assertEquals(line, wrapped2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test commentSelection")
|
||||||
|
public void testCommentSelection() {
|
||||||
|
String selection = "This\nis a multiline\nstring";
|
||||||
|
|
||||||
|
assertEquals(selection, lang.commentSelection(selection));
|
||||||
|
assertEquals(selection, lang.commentSelection(lang.commentSelection(selection)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test unCommentSelection")
|
||||||
|
public void testUnCommentSelection() {
|
||||||
|
String selection = "This\nis a multiline\nstring";
|
||||||
|
|
||||||
|
assertEquals(selection, lang.unCommentSelection(selection));
|
||||||
|
assertEquals(selection, lang.unCommentSelection(lang.unCommentSelection(selection)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test isCommentedLine")
|
||||||
|
public void testIsCommentedLine() {
|
||||||
|
String line = "test";
|
||||||
|
|
||||||
|
assertFalse(lang.isCommentedLine(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test isCommentedSelection")
|
||||||
|
public void testIsCommentedSelection() {
|
||||||
|
String selection = "test";
|
||||||
|
|
||||||
|
assertFalse(lang.isCommentedSelection(selection));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user