Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5c8cda6 authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "Test for "data" in Ravenwood tests." into main

parents 4790d334 aad1a384
Loading
Loading
Loading
Loading
+12 −24
Original line number Diff line number Diff line
@@ -7,8 +7,8 @@ package {
    default_applicable_licenses: ["frameworks_base_license"],
}

android_ravenwood_test {
    name: "RavenwoodCoreTest",
java_defaults {
    name: "RavenwoodCoreTest_defaults",

    static_libs: [
        "androidx.annotation_annotation",
@@ -28,39 +28,27 @@ android_ravenwood_test {
        "test/**/*.java",
        "test/**/*.kt",
    ],
    data: ["data/**/*"],
    ravenizer: {
        strip_mockito: true,
    },
    auto_gen_config: true,
}

// Same as RavenwoodCoreTest, but it excludes tests using platform-parametric-runner-lib,
// because that modules has too many dependencies and slow to build incrementally.
android_ravenwood_test {
    name: "RavenwoodCoreTest-light",

    name: "RavenwoodCoreTest",
    defaults: ["RavenwoodCoreTest_defaults"],
    static_libs: [
        "androidx.annotation_annotation",
        "androidx.test.ext.junit",
        "androidx.test.rules",

        // This library should be removed by Ravenizer
        "mockito-target-minus-junit4",
    ],
    libs: [
        // We access internal private classes
        "ravenwood-junit-impl",
    ],
    srcs: [
        "test/**/*.java",
        "test/**/*.kt",
        "platform-parametric-runner-lib",
    ],
}

// Same as RavenwoodCoreTest, but it excludes tests using platform-parametric-runner-lib,
// because that modules has too many dependencies and slow to build incrementally.
android_ravenwood_test {
    name: "RavenwoodCoreTest-light",
    defaults: ["RavenwoodCoreTest_defaults"],
    exclude_srcs: [
        "test/com/android/ravenwoodtest/runnercallbacktests/*",
    ],
    ravenizer: {
        strip_mockito: true,
    },
    auto_gen_config: true,
}
+1 −0
Original line number Diff line number Diff line
datafile1
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
datafile2
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
morefile
 No newline at end of file
+42 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * 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 com.android.ravenwoodtest.coretest;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import java.io.File;
import java.util.Scanner;

/**
 * Random small tests.
 */
public class RavenwoodCoreBasicTest {

    private static String readFile(String file) throws Exception {
        try (var s = new Scanner(new File(file)).useDelimiter("\\Z")) {
            return s.next();
        }
    }

    @Test
    public void testDataFilesExist() throws Exception {
        assertEquals("datafile1", readFile("data/datafile1.txt"));
        assertEquals("datafile2", readFile("data/datafile2.txt"));
        assertEquals("morefile", readFile("data/subdir/morefile.txt"));
    }
}