summaryrefslogtreecommitdiff
path: root/luni
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-05-24 10:44:40 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-24 10:44:40 -0700
commit808b309c70b00efc28e638a9bc026cd83200cdbd (patch)
tree6503f5115bb2ec0e2bff20adc75252ac48e61d9b /luni
parent747d4cd5e39da3be38ec1d2da9fb7403006ed7c4 (diff)
parentcc1c3883689b9848b961cb8940241709bc7358bb (diff)
downloadapache-harmony-808b309c70b00efc28e638a9bc026cd83200cdbd.tar.gz
Merge "Make the reason for a test failure more obvious." into dalvik-dev
Diffstat (limited to 'luni')
-rw-r--r--luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java30
1 files changed, 13 insertions, 17 deletions
diff --git a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java
index fe1cc6b..f8a0daf 100644
--- a/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java
+++ b/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/FileInputStreamTest.java
@@ -109,43 +109,39 @@ public class FileInputStreamTest extends TestCase {
}
}
- /**
- * @tests java.io.FileInputStream#close()
- */
public void test_close() throws IOException {
is = new FileInputStream(fileName);
is.close();
-
try {
is.read();
- fail("Able to read from closed stream");
- } catch (IOException e) {
- // Expected
+ fail();
+ } catch (IOException expected) {
}
+ }
+ public void test_close_shared_fd() throws IOException {
// Regression test for HARMONY-6642
- FileInputStream fis = new FileInputStream(fileName);
- FileInputStream fis2 = new FileInputStream(fis.getFD());
+ FileInputStream fis1 = new FileInputStream(fileName);
+ FileInputStream fis2 = new FileInputStream(fis1.getFD());
try {
fis2.close();
- fis.read();
- fail("Able to read from closed fd");
- } catch (IOException e) {
- // Expected
+ fis1.read();
+ fail("fd sharing error");
+ } catch (IOException expected) {
} finally {
try {
- fis.close();
+ fis1.close();
} catch (IOException e) {}
}
+ // TODO: how does this differ from the test above?
FileInputStream stdin = new FileInputStream(FileDescriptor.in);
stdin.close();
stdin = new FileInputStream(FileDescriptor.in);
try {
stdin.read();
- fail("Able to read from stdin after close");
- } catch (IOException e) {
- // Expected
+ fail();
+ } catch (IOException expected) {
}
}