add tests for js-maven projects

This commit is contained in:
Michael Nedzelsky
2014-12-02 03:07:35 +03:00
parent c6ce4d404a
commit 5f57605b81
11 changed files with 326 additions and 1 deletions
@@ -527,6 +527,7 @@ fun main(args: Array<String>) {
model("configuration/android-gradle", pattern = """(\w+)_before\.gradle$""", testMethod = "doTestAndroidGradle")
model("configuration/gradle", pattern = """(\w+)_before\.gradle$""", testMethod = "doTestGradle")
model("configuration/maven", extension = null, recursive = false, testMethod = "doTestWithMaven")
model("configuration/js-maven", extension = null, recursive = false, testMethod = "doTestWithJSMaven")
}
testClass(javaClass<AbstractJetFormatterTest>()) {
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>js</id>
<phase>compile</phase>
<goals>
<goal>js</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<kotlin.version>$VERSION$</kotlin.version>
</properties>
</project>
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>js</id>
<phase>compile</phase>
<goals>
<goal>js</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-js-library</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<properties>
<kotlin.version>$VERSION$</kotlin.version>
</properties>
</project>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<kotlin.version>$VERSION$</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-js-library</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>js</id>
<phase>compile</phase>
<goals>
<goal>js</goal>
</goals>
<configuration>
<sourceDirs>
<source></source>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<kotlin.version>$VERSION$</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-js-library</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>js</id>
<phase>compile</phase>
<goals>
<goal>js</goal>
</goals>
<configuration>
<sourceDirs>
<source></source>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-js-library</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<properties>
<kotlin.version>$VERSION$</kotlin.version>
</properties>
</project>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
<!--
// VERSION: 0.1-SNAPSHOT
-->
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>js</id>
<phase>compile</phase>
<goals>
<goal>js</goal>
</goals>
<configuration>
<sourceDirs>
<source></source>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>sonatype.oss.snapshots</id>
<name>Sonatype OSS Snapshot Repository</name>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>sonatype.oss.snapshots</id>
<name>Sonatype OSS Snapshot Repository</name>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-js-library</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<properties>
<kotlin.version>$VERSION$</kotlin.version>
</properties>
</project>
<!--
// VERSION: $VERSION$
-->
@@ -33,6 +33,11 @@ public abstract class AbstractConfigureProjectByChangingFileTest extends LightCo
doTest(pathWithFile, pathWithFile.replace("pom", "pom_after"), new KotlinJavaMavenConfigurator());
}
public void doTestWithJSMaven(@NotNull String path) throws Exception {
String pathWithFile = path + "/" + MavenConstants.POM_XML;
doTest(pathWithFile, pathWithFile.replace("pom", "pom_after"), new KotlinJavascriptMavenConfigurator());
}
public void doTestAndroidGradle(@NotNull String path) throws Exception {
doTest(path, path.replace("before", "after"), new KotlinAndroidGradleModuleConfigurator());
}
@@ -28,7 +28,7 @@ import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@InnerTestClasses({ConfigureProjectByChangingFileTestGenerated.Android_gradle.class, ConfigureProjectByChangingFileTestGenerated.Gradle.class, ConfigureProjectByChangingFileTestGenerated.Maven.class})
@InnerTestClasses({ConfigureProjectByChangingFileTestGenerated.Android_gradle.class, ConfigureProjectByChangingFileTestGenerated.Gradle.class, ConfigureProjectByChangingFileTestGenerated.Maven.class, ConfigureProjectByChangingFileTestGenerated.Js_maven.class})
@RunWith(JUnit3RunnerWithInners.class)
public class ConfigureProjectByChangingFileTestGenerated extends AbstractConfigureProjectByChangingFileTest {
@TestMetadata("idea/testData/configuration/android-gradle")
@@ -223,4 +223,37 @@ public class ConfigureProjectByChangingFileTestGenerated extends AbstractConfigu
doTestWithMaven(fileName);
}
}
@TestMetadata("idea/testData/configuration/js-maven")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Js_maven extends AbstractConfigureProjectByChangingFileTest {
public void testAllFilesPresentInJs_maven() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/configuration/js-maven"), Pattern.compile("^([^\\.]+)$"), false);
}
@TestMetadata("libraryMissed")
public void testLibraryMissed() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/configuration/js-maven/libraryMissed/");
doTestWithJSMaven(fileName);
}
@TestMetadata("pluginMissed")
public void testPluginMissed() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/configuration/js-maven/pluginMissed/");
doTestWithJSMaven(fileName);
}
@TestMetadata("simpleProject")
public void testSimpleProject() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/configuration/js-maven/simpleProject/");
doTestWithJSMaven(fileName);
}
@TestMetadata("simpleProjectSnapshot")
public void testSimpleProjectSnapshot() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/configuration/js-maven/simpleProjectSnapshot/");
doTestWithJSMaven(fileName);
}
}
}