Skip to content

Commit a859291

Browse files
committed
Merge branch 'main' of github.com:subha0319/liquidjava
2 parents 3d4bd2f + 478ec1e commit a859291

File tree

9 files changed

+30
-27
lines changed

9 files changed

+30
-27
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Additionally, you'll need the following dependency, which includes the LiquidJav
4747
#### Maven
4848
```xml
4949
<dependency>
50-
<groupId>io.github.rcosta358</groupId>
50+
<groupId>io.github.liquid-java</groupId>
5151
<artifactId>liquidjava-api</artifactId>
5252
<version>0.0.3</version>
5353
</dependency>
@@ -60,7 +60,7 @@ repositories {
6060
}
6161
6262
dependencies {
63-
implementation 'io.github.rcosta358:liquidjava-api:0.0.3'
63+
implementation 'io.github.liquid-java:liquidjava-api:0.0.3'
6464
}
6565
```
6666

liquidjava-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>io.github.rcosta358</groupId>
6+
<groupId>io.github.liquid-java</groupId>
77
<artifactId>liquidjava-api</artifactId>
88
<version>0.0.3</version>
99
<name>liquidjava-api</name>

liquidjava-api/release.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mvn -Dgpg.skip=false -Dmaven.deploy.skip=false clean deploy

liquidjava-example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<version>${version.memcompiler}</version>
4949
</dependency>
5050
<dependency>
51-
<groupId>io.github.rcosta358</groupId>
51+
<groupId>io.github.liquid-java</groupId>
5252
<artifactId>liquidjava-api</artifactId>
5353
<version>0.0.3</version>
5454
</dependency>

liquidjava-example/src/main/java/testSuite/ErrorAfterIf.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @ExpectedError: "Type expected:(#r_26 == a || #r_26 == b)"
1+
// @ExpectedError: "Type expected"
22
package testSuite;
33

44
import liquidjava.specification.Refinement;

liquidjava-example/src/main/java/testSuite/ErrorArithmeticBinaryOperations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @ExpectedError: "Type expected:(#z_2 > 0)"
1+
// @ExpectedError: "Type expected"
22
package testSuite;
33

44
import liquidjava.specification.Refinement;

liquidjava-example/src/main/java/testSuite/ErrorSimpleAssignment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @ExpectedError: "Type expected:(#c_0 > 2)"
1+
// @ExpectedError: "Type expected"
22
package testSuite;
33

44
import liquidjava.specification.Refinement;

liquidjava-verifier/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
</dependency>
173173

174174
<dependency>
175-
<groupId>io.github.rcosta358</groupId>
175+
<groupId>io.github.liquid-java</groupId>
176176
<artifactId>liquidjava-api</artifactId>
177177
<version>0.0.3</version>
178178
</dependency>

liquidjava-verifier/src/test/java/liquidjava/api/tests/TestExamples.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.nio.file.Path;
88
import java.nio.file.Paths;
99
import java.util.stream.Stream;
10+
import java.util.Optional;
1011
import liquidjava.api.CommandLineLauncher;
1112
import liquidjava.diagnostics.ErrorEmitter;
1213

@@ -51,16 +52,18 @@ public void testFile(final Path filePath) throws IOException {
5152
fail();
5253
} else {
5354
// NEW: Check if it's the *correct* error
54-
String expectedError = getExpectedError(filePath);
55+
Optional<String> expectedError = getExpectedError(filePath);
5556

5657
// If an expected error is specified in the file, check it.
57-
// We check the 'title' for a match.
58-
if (expectedError != null) {
59-
String actualErrorTitle = errorEmitter.getTitleMessage(); //
60-
if (actualErrorTitle == null || !actualErrorTitle.equals(expectedError)) {
58+
if (expectedError.isPresent()) {
59+
String expected = expectedError.get();
60+
String actualErrorTitle = errorEmitter.getTitleMessage();
61+
62+
if (actualErrorTitle == null || !actualErrorTitle.contains(expected)) {
6163
System.out.println("Error in directory: " + fileName + " --- wrong error message found.");
62-
System.out.println(" Expected: " + expectedError);
63-
System.out.println(" Actual: " + (actualErrorTitle != null ? actualErrorTitle : "NULL"));
64+
System.out.println(" Expected to contain: \"" + expected + "\"");
65+
System.out.println(" Actual: \""
66+
+ (actualErrorTitle != null ? actualErrorTitle : "NULL") + "\"");
6467
fail();
6568
}
6669
}
@@ -113,30 +116,29 @@ public void testMultiplePaths() {
113116
}
114117

115118
/**
116-
* Reads the given file to find an expected error message specified in a comment. The comment format is: //
117-
*
118-
* @ExpectedError: "Error Title"
119+
* Reads the given file to find an expected error message specified in a comment on the first line. The comment
120+
* format is: // @ExpectedError: "Error Title"
119121
*
120122
* @param filePath
121123
* path to the test file
122124
*
123-
* @return The expected error title, or null if not specified.
125+
* @return An Optional containing the expected error string, or Optional.empty() if not specified or if it's a
126+
* directory.
124127
*
125128
* @throws IOException
126129
* if an I/O error occurs
127130
*/
128-
private String getExpectedError(Path filePath) throws IOException {
131+
private Optional<String> getExpectedError(Path filePath) throws IOException {
129132
if (Files.isDirectory(filePath)) {
130-
// Currently, we don't support expected errors for entire directories.
131-
return null;
133+
return Optional.empty();
132134
}
133135

134-
// Try to find the expected error comment in the first 10 lines
135-
try (Stream<String> lines = Files.lines(filePath).limit(10)) {
136-
return lines.map(String::trim).filter(line -> line.startsWith("// @ExpectedError:")).findFirst()
136+
// Try to find the expected error comment on the first line
137+
try (Stream<String> lines = Files.lines(filePath)) {
138+
return lines.findFirst() // Get only the first line
139+
.map(String::trim).filter(line -> line.startsWith("// @ExpectedError:"))
137140
.map(line -> line.substring(line.indexOf(":") + 1).trim()) // Get text after the colon
138-
.map(line -> line.replace("\"", "")) // Remove quotes
139-
.orElse(null); // No expected error specified
141+
.map(line -> line.replace("\"", "")); // Remove quotes
140142
}
141143
}
142144
}

0 commit comments

Comments
 (0)