1 // Tags: JDK1.1 |
|
2 |
|
3 // Copyright (C) 2005 Free Software Foundation |
|
4 // Contributed by Mark Wielaard (mark@klomp.org) |
|
5 |
|
6 // This file is part of Mauve. |
|
7 |
|
8 // Mauve is free software; you can redistribute it and/or modify |
|
9 // it under the terms of the GNU General Public License as published by |
|
10 // the Free Software Foundation; either version 2, or (at your option) |
|
11 // any later version. |
|
12 |
|
13 // Mauve is distributed in the hope that it will be useful, |
|
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 // GNU General Public License for more details. |
|
17 |
|
18 // You should have received a copy of the GNU General Public License |
|
19 // along with Mauve; see the file COPYING. If not, write to |
|
20 // the Free Software Foundation, 59 Temple Place - Suite 330, |
|
21 // Boston, MA 02111-1307, USA. |
|
22 |
|
23 |
|
24 package gnu.testlet.java.io.BufferedReader; |
|
25 |
|
26 import gnu.testlet.Testlet; |
|
27 import gnu.testlet.TestHarness; |
|
28 import java.io.*; |
|
29 |
|
30 /** |
|
31 * Small test based on a regression in GNU Classpath. |
|
32 */ |
|
33 public class mark implements Testlet |
|
34 { |
|
35 public void test(TestHarness harness) |
|
36 { |
|
37 try |
|
38 { |
|
39 byte[] bs = new byte[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', |
|
40 'h' ,'i', 'j', 'k', 'l', 'm', 'n' }; |
|
41 ByteArrayInputStream bais = new ByteArrayInputStream(bs); |
|
42 InputStreamReader isr = new InputStreamReader(bais, "utf-8"); |
|
43 BufferedReader br = new BufferedReader(isr); |
|
44 |
|
45 char[] cs = new char[4]; |
|
46 br.mark(4); |
|
47 br.read(cs); |
|
48 harness.check('a', cs[0]); |
|
49 harness.check('b', cs[1]); |
|
50 harness.check('c', cs[2]); |
|
51 harness.check('d', cs[3]); |
|
52 br.reset(); |
|
53 |
|
54 br.mark(12); |
|
55 harness.check('a', br.read()); |
|
56 harness.check('b', br.read()); |
|
57 harness.check('c', br.read()); |
|
58 harness.check('d', br.read()); |
|
59 harness.check('e', br.read()); |
|
60 harness.check('f', br.read()); |
|
61 harness.check('g', br.read()); |
|
62 harness.check('h', br.read()); |
|
63 harness.check('i', br.read()); |
|
64 harness.check('j', br.read()); |
|
65 harness.check('k', br.read()); |
|
66 harness.check('l', br.read()); |
|
67 harness.check('m', br.read()); |
|
68 harness.check('n', br.read()); |
|
69 |
|
70 harness.check(-1, br.read()); |
|
71 } |
|
72 catch (IOException e) |
|
73 { |
|
74 harness.debug(e); |
|
75 harness.check(false); |
|
76 } |
|
77 } |
|
78 } |
|
79 |
|