Skip to content

Commit

Permalink
Moved test to RegressionTests
Browse files Browse the repository at this point in the history
  • Loading branch information
PieterOlivier committed Jun 18, 2024
1 parent 0972335 commit 478d5f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 29 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;

import org.junit.jupiter.params.ParameterizedTest;
Expand All @@ -14,8 +16,10 @@
import io.usethesource.vallang.IConstructor;
import io.usethesource.vallang.ISet;
import io.usethesource.vallang.ISourceLocation;
import io.usethesource.vallang.IString;
import io.usethesource.vallang.IValueFactory;
import io.usethesource.vallang.ValueProvider;
import io.usethesource.vallang.io.StandardTextReader;
import io.usethesource.vallang.io.StandardTextWriter;
import io.usethesource.vallang.type.Type;
import io.usethesource.vallang.type.TypeFactory;
Expand Down Expand Up @@ -60,5 +64,18 @@ void keywordFieldsMakeConstructorsDifferent(IValueFactory vf, TypeFactory tf, Ty

assertFalse(cons1.equals(cons2));
}


private IString readString(IValueFactory valueFactory, TypeStore typeStore, String s) throws IOException {
Reader reader = new StringReader(s);
StandardTextReader textReader = new StandardTextReader();
return (IString) textReader.read(valueFactory, typeStore, TypeFactory.getInstance().stringType(), reader);

}

@ParameterizedTest @ArgumentsSource(ValueProvider.class)
void escapeNormalCharacters(IValueFactory valueFactory, TypeStore typeStore) throws IOException {
IString s = readString(valueFactory, typeStore, "\"\\$\"");
assertEquals("$", s.getValue());
}

}

0 comments on commit 478d5f7

Please sign in to comment.