java-commons/muscript/src/test/java/io/gitlab/jfronny/muscript/test/StringTest.java

24 lines
731 B
Java

package io.gitlab.jfronny.muscript.test;
import org.junit.jupiter.api.*;
import static io.gitlab.jfronny.muscript.test.util.MuTestUtil.*;
import static org.junit.jupiter.api.Assertions.*;
class StringTest {
@Test
void operators() {
assertEquals("Hello, world!", string("'Hello, ' || 'world!'"));
assertEquals("Yes 15 hello", string("'Yes ' || 16 - 1 || ' hello'"));
assertEquals("Value", string("string"));
assertTrue(bool("string == 'Value'"));
assertFalse(bool("string == 'Something else'"));
}
@Test
void concatComparison() {
assertEquals("Hellotrue", string("'Hello' || -12 < 5"));
assertEquals("trueHello", string("-12 < 5 || 'Hello'"));
}
}