-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler and runtime tests for generic and inner types, plus fixes #135
- Loading branch information
1 parent
89f8ab5
commit eb8dce2
Showing
9 changed files
with
222 additions
and
38 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
117 changes: 117 additions & 0 deletions
117
...clipse/viatra/query/patternlanguage/emf/tests/generator/TypingEdgeCasesCompilerTest.xtend
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,117 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2010-2024, BergmannG, IncQuery Labs | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-v20.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.viatra.query.patternlanguage.emf.tests.generator | ||
|
||
import org.junit.rules.TestName | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class TypingEdgeCasesCompilerTest extends AbstractQueryCompilerTest { | ||
static val TEST_PROJECT_NAME_PREFIX = "org.eclipse.viatra.query.test" | ||
|
||
|
||
static val TEST_CONTENTS_GENERIC = ''' | ||
package test | ||
import "http://www.eclipse.org/emf/2002/Ecore" | ||
pattern foo(e: java ^java.util.Map, u: java Integer) { | ||
e == eval(^java.util.Collections.singletonMap(1,2)); | ||
u == 4; | ||
} | ||
''' | ||
|
||
|
||
static val TEST_CONTENTS_INNERCLASS = ''' | ||
package test | ||
import "http://www.eclipse.org/emf/2002/Ecore" | ||
pattern bar(e: java ^org.eclipse.emf.ecore.EcorePackage.Literals, u: java Integer) { | ||
e == eval(null as org.eclipse.emf.ecore.EcorePackage.Literals); | ||
u == 4; | ||
} | ||
''' | ||
|
||
|
||
static val TEST_CONTENTS_GENERIC_INNERCLASS = ''' | ||
package test | ||
import "http://www.eclipse.org/emf/2002/Ecore" | ||
pattern baz(e: java ^java.util.Map.Entry, u: java Integer) { | ||
e == eval(^java.util.Collections.singletonMap(1,2).entrySet.head); | ||
u == 4; | ||
} | ||
''' | ||
|
||
static val TEST_CONTENTS_GENERIC_INNERCLASS_INFERRED = ''' | ||
package test | ||
import "http://www.eclipse.org/emf/2002/Ecore" | ||
pattern bang(e, u: java Integer) { | ||
e == eval(^java.util.Collections.singletonMap(1,2).entrySet.head); | ||
u == 4; | ||
} | ||
''' | ||
static val TEST_CONTENTS_JAVACONST_INNERCLASS = ''' | ||
package test | ||
import "http://www.eclipse.org/emf/2002/Ecore" | ||
pattern fee(e: java org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint.BackendRequirement, u: java Integer) { | ||
e == java org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint.BackendRequirement::SPECIFIC; | ||
u == 4; | ||
} | ||
''' | ||
static val TEST_CONTENTS_JAVACONST_INNERCLASS_INFERRED = ''' | ||
package test | ||
import "http://www.eclipse.org/emf/2002/Ecore" | ||
pattern fie(e, u: java Integer) { | ||
e == java org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint.BackendRequirement::SPECIFIC; | ||
u == 4; | ||
} | ||
''' | ||
|
||
|
||
@Rule | ||
public val name = new TestName | ||
|
||
override String calculateTestProjectName() { | ||
TEST_PROJECT_NAME_PREFIX + "." + name.methodName | ||
} | ||
|
||
@Test | ||
def void compileGenericClass() { | ||
testFileCreationAndBuild(TEST_CONTENTS_GENERIC, 0) | ||
} | ||
@Test | ||
def void compileInnerClass() { | ||
testFileCreationAndBuild(TEST_CONTENTS_INNERCLASS, 0) | ||
} | ||
@Test | ||
def void compileGenericInnerClass() { | ||
testFileCreationAndBuild(TEST_CONTENTS_GENERIC_INNERCLASS, 0) | ||
} | ||
@Test | ||
def void compileGenericInnerClassInferred() { | ||
testFileCreationAndBuild(TEST_CONTENTS_GENERIC_INNERCLASS_INFERRED, 0) | ||
} | ||
@Test | ||
def void compileJavaconstInnerClass() { | ||
testFileCreationAndBuild(TEST_CONTENTS_JAVACONST_INNERCLASS, 0) | ||
} | ||
@Test | ||
def void compileJavaconstInnerClassInferred() { | ||
testFileCreationAndBuild(TEST_CONTENTS_JAVACONST_INNERCLASS_INFERRED, 0) | ||
} | ||
} |
Oops, something went wrong.