blob: f7da49a2be0bccc027e91028fb1a89b42d352de4 [file] [log] [blame]
/*
* Copyright 2018 The Bazel Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.bazel.ruleskotlin.integrationtests.jvm
import io.bazel.ruleskotlin.integrationtests.lib.AssertionTestCase
import org.junit.Test
class JvmBasicIntegrationTests : AssertionTestCase("tests/integrationtests/jvm/basic") {
// Resources tests /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Test
fun mergeResourceJars() = withTestCaseJar("test_merge_resourcesjar.jar") {
assertContainsEntries("testresources/AClass.class", "testresources/BClass.class", "pkg/file.txt")
}
@Test
fun embedResources() = withTestCaseJar("test_embed_resources.jar") {
assertContainsEntries(
"testresources/AClass.class",
"testresources/BClass.class",
"tests/integrationtests/jvm/basic/testresources/resources/one/alsoAFile.txt",
"tests/integrationtests/jvm/basic/testresources/resources/one/two/aFile.txt"
)
}
@Test
fun resourcesStripPrefix() = withTestCaseJar("test_embed_resources_strip_prefix.jar") {
assertContainsEntries("testresources/AClass.class", "testresources/BClass.class", "one/two/aFile.txt", "one/alsoAFile.txt")
}
@Test
fun resourcesHaveConventionPathsStripped() = withTestCaseJar("conventional_strip_resources.jar") { assertContainsEntries("main.txt", "test.txt") }
// Dependency propogation tests ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Test
fun runtimeDepsArePropogatedViaExport() = assertExecutableRunfileSucceeds("propagation_rt_via_export_consumer")
@Test
fun runtimeDepsArePropogatedTransitively() = assertExecutableRunfileSucceeds("propagation_rt_via_runtime_deps_consumer")
// Module naming tests /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Test
fun moduleNameIsDervidedOnBin() = withTestCaseJar("test_module_name_bin.jar") {
assertContainsEntries("META-INF/tests_integrationtests_jvm_basic-test_module_name_bin.kotlin_module")
}
@Test
fun moduleNameIsUsedOnBin() = withTestCaseJar("test_module_name_attr_bin.jar") {
assertContainsEntries("META-INF/hello-module.kotlin_module")
}
}