source: branches/1.3.3/abcl/test/src/org/armedbear/lisp/StreamTest.java

Last change on this file was 12597, checked in by ehuelsmann, 15 years ago

Consolidate faslRead, faslReadArray, faslReadComplex and faslReadPathname
with their non-'fasl' versions.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 929 bytes
Line 
1package org.armedbear.lisp;
2
3import static org.junit.Assert.*;
4
5import java.io.File;
6import java.io.FileWriter;
7import org.junit.Test;
8import java.io.IOException;
9
10public class StreamTest
11{
12  @Test
13  public void readLispObject() {
14    File file = null;
15    try {
16      file = File.createTempFile("foo", "lisp");
17      FileWriter output = new FileWriter(file);
18      String contents = "(defun foo () 42)";
19      output.append(contents);
20      output.close();
21    } catch (IOException e) {
22      System.out.println("Failed to create temp file" + e);
23      return;
24    }
25    Pathname pathname = Pathname.makePathname(file);
26    Stream in = new Stream(Symbol.SYSTEM_STREAM, pathname.getInputStream(), Symbol.CHARACTER);
27    LispObject o = in.read(false, Lisp.EOF, false,
28                           LispThread.currentThread(), Stream.currentReadtable);
29    assertFalse(o.equals(Lisp.NIL));
30    in._close();
31    file.delete();
32  }
33}   
Note: See TracBrowser for help on using the repository browser.