forked from javaparser/javaparser
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
javaparser-core-testing/src/test/java/com/github/javaparser/JKIssue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (C) 2013-2024 The JavaParser Team. | ||
* | ||
* This file is part of JavaParser. | ||
* | ||
* JavaParser can be used either under the terms of | ||
* a) the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* b) the terms of the Apache License | ||
* | ||
* You should have received a copy of both licenses in LICENCE.LGPL and | ||
* LICENCE.APACHE. Please refer to those files for details. | ||
* | ||
* JavaParser is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
*/ | ||
|
||
package com.github.javaparser; | ||
|
||
import com.github.javaparser.ast.CompilationUnit; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Paths; | ||
|
||
public class JKIssue { | ||
@Test() | ||
void test() throws IOException { | ||
ParserConfiguration cfg = new ParserConfiguration(); | ||
cfg.setProcessJml(true); | ||
JavaParser parser = new JavaParser(cfg); | ||
CompilationUnit cu = parser.parse(Paths.get("src/test/test_sourcecode/JKIssueDoubleContract.java")) | ||
.getResult().get(); | ||
|
||
var methods = cu.getPrimaryType().get().getMethods(); | ||
for (var method : methods) { | ||
Assertions.assertEquals(1, method.getContracts().get().size()); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
javaparser-core-testing/src/test/test_sourcecode/JKIssueDoubleContract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Created by jklamroth on 12/18/18. | ||
*/ | ||
public class JKIssueDoubleContract { | ||
|
||
//@ ensures \result == 56; | ||
private int test() { | ||
} | ||
|
||
|
||
//@ ensures \result == 56; | ||
private int test1() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters