Projects
openEuler:24.03:SP1:Everything:64G
guava
_service:tar_scm:CVE-2023-2976-pre.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:CVE-2023-2976-pre.patch of Package guava
From 364aed58e083e305f3f9ffc5bcacf9536f2472ab Mon Sep 17 00:00:00 2001 From: cpovirk <cpovirk@google.com> Date: Tue, 25 Apr 2023 10:00:41 -0700 Subject: [PATCH] Split the tests for `Files.createTempDir` into a separate file. This makes it easier to run them a second time under a newer Android emulator in our internal tests. RELNOTES=n/a PiperOrigin-RevId: 526998248 Origin: https://github.com/google/guava/commit/364aed58e083e305f3f9ffc5bcacf9536f2472ab --- .../common/io/FilesCreateTempDirTest.java | 38 +++++++++++++++++++ .../test/com/google/common/io/FilesTest.java | 15 +++----- .../common/io/FilesCreateTempDirTest.java | 37 ++++++++++++++++++ .../test/com/google/common/io/FilesTest.java | 15 +++----- 4 files changed, 87 insertions(+), 18 deletions(-) create mode 100644 android/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java create mode 100644 guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java diff --git a/android/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java b/android/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java new file mode 100644 index 0000000..109342a --- /dev/null +++ b/android/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2007 The Guava Authors + * + * 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.google.common.io; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.File; +import junit.framework.TestCase; + +/** + * Unit test for {@link Files#createTempDir}. + * + * @author Chris Nokleberg + */ + +public class FilesCreateTempDirTest extends TestCase { + public void testCreateTempDir() { + File temp = Files.createTempDir(); + assertTrue(temp.exists()); + assertTrue(temp.isDirectory()); + assertThat(temp.listFiles()).isEmpty(); + assertTrue(temp.delete()); + } +} diff --git a/android/guava-tests/test/com/google/common/io/FilesTest.java b/android/guava-tests/test/com/google/common/io/FilesTest.java index 8446da1..338059e 100644 --- a/android/guava-tests/test/com/google/common/io/FilesTest.java +++ b/android/guava-tests/test/com/google/common/io/FilesTest.java @@ -42,7 +42,12 @@ import junit.framework.TestSuite; /** * Unit test for {@link Files}. * - * <p>Note: {@link Files#fileTraverser()} is tested in {@link FilesFileTraverserTest}. + * <p>Some methods are tested in separate files: + * + * <ul> + * <li>{@link Files#fileTraverser()} is tested in {@link FilesFileTraverserTest}. + * <li>{@link Files#createTempDir()} is tested in {@link FilesCreateTempDirTest}. + * </ul> * * @author Chris Nokleberg */ @@ -357,14 +362,6 @@ public class FilesTest extends IoTestCase { } } - public void testCreateTempDir() { - File temp = Files.createTempDir(); - assertTrue(temp.exists()); - assertTrue(temp.isDirectory()); - assertThat(temp.listFiles()).isEmpty(); - assertTrue(temp.delete()); - } - public void testMove() throws IOException { File i18nFile = getTestFile("i18n.txt"); File temp1 = createTempFile(); diff --git a/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java b/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java new file mode 100644 index 0000000..557689e --- /dev/null +++ b/guava-tests/test/com/google/common/io/FilesCreateTempDirTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2007 The Guava Authors + * + * 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.google.common.io; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.File; + +/** + * Unit test for {@link Files#createTempDir}. + * + * @author Chris Nokleberg + */ + +public class FilesCreateTempDirTest extends IoTestCase { + public void testCreateTempDir() { + File temp = Files.createTempDir(); + assertTrue(temp.exists()); + assertTrue(temp.isDirectory()); + assertThat(temp.listFiles()).isEmpty(); + assertTrue(temp.delete()); + } +} diff --git a/guava-tests/test/com/google/common/io/FilesTest.java b/guava-tests/test/com/google/common/io/FilesTest.java index 8446da1..338059e 100644 --- a/guava-tests/test/com/google/common/io/FilesTest.java +++ b/guava-tests/test/com/google/common/io/FilesTest.java @@ -42,7 +42,12 @@ import junit.framework.TestSuite; /** * Unit test for {@link Files}. * - * <p>Note: {@link Files#fileTraverser()} is tested in {@link FilesFileTraverserTest}. + * <p>Some methods are tested in separate files: + * + * <ul> + * <li>{@link Files#fileTraverser()} is tested in {@link FilesFileTraverserTest}. + * <li>{@link Files#createTempDir()} is tested in {@link FilesCreateTempDirTest}. + * </ul> * * @author Chris Nokleberg */ @@ -357,14 +362,6 @@ public class FilesTest extends IoTestCase { } } - public void testCreateTempDir() { - File temp = Files.createTempDir(); - assertTrue(temp.exists()); - assertTrue(temp.isDirectory()); - assertThat(temp.listFiles()).isEmpty(); - assertTrue(temp.delete()); - } - public void testMove() throws IOException { File i18nFile = getTestFile("i18n.txt"); File temp1 = createTempFile(); -- 2.41.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2