Exemplo n.º 1
0
 @Test
 public void testCons1() {
   lwriter.writeCons(new Cons("", new Symbol("find-buffer-file-type-coding-system")));
   assertEquals("(\"\" . find-buffer-file-type-coding-system)", output.toString());
   reset();
   lwriter.writeUnknown(new Cons("", new Symbol("find-buffer-file-type-coding-system")));
   assertEquals("(\"\" . find-buffer-file-type-coding-system)", output.toString());
 }
Exemplo n.º 2
0
 @Test
 public void testDouble1() {
   lwriter.writeDouble(10.1d);
   assertEquals("10.1", output.toString());
   reset();
   lwriter.writeUnknown(10.1d);
   assertEquals("10.1", output.toString());
 }
Exemplo n.º 3
0
 @Test
 public void testInt1() {
   lwriter.writeInt(1010);
   assertEquals("1010", output.toString());
   reset();
   lwriter.writeUnknown(1010);
   assertEquals("1010", output.toString());
 }
Exemplo n.º 4
0
 @Test
 public void testForm1() {
   List l = Arrays.asList(new Symbol("message"), "Hello %s", new Symbol("user-full-name"));
   lwriter.writeForm(l);
   assertEquals("(message \"Hello %s\" user-full-name)", output.toString());
   reset();
   lwriter.writeUnknown(l);
   assertEquals("'(message \"Hello %s\" user-full-name)", output.toString());
 }
Exemplo n.º 5
0
 @Test
 public void testChars() {
   lwriter.writeChar('a');
   assertEquals("?a", output.toString());
   reset();
   lwriter.writeChar('?');
   assertEquals("?\\?", output.toString());
   reset();
   lwriter.writeChar('\\');
   assertEquals("?\\\\", output.toString());
 }
Exemplo n.º 6
0
 @Test
 public void testMapAlist() {
   Map<Object, Object> m = new LinkedHashMap<>();
   m.put("foo", new Symbol("bar"));
   m.put("baz", new Symbol("quux"));
   lwriter.writeAlist(m);
   assertEquals("'((\"foo\" . bar) (\"baz\" . quux))", output.toString());
   reset();
   lwriter.writeUnknown(m);
   assertEquals("'((\"foo\" . bar) (\"baz\" . quux))", output.toString());
 }
Exemplo n.º 7
0
 @Test
 public void testQuoted1() {
   List l = new ArrayList();
   l.add(new Symbol("apply"));
   l.add(new Quoted(new Symbol("+")));
   l.add(1);
   l.add(2);
   List inner = new ArrayList();
   inner.add(3);
   inner.add(4);
   l.add(new Quoted(inner));
   lwriter.writeForm(l);
   assertEquals("(apply '+ 1 2 '(3 4))", output.toString());
   reset();
   lwriter.writeUnknown(l);
   assertEquals("'(apply '+ 1 2 '(3 4))", output.toString());
 }
Exemplo n.º 8
0
  @Test
  public void testWriteJdeeJuciInvokeElispForm() {
    List eval = new ArrayList();
    eval.add(new Symbol("jdee-juci-invoke-elisp"));

    List form = new ArrayList();
    form.add(new Symbol("message"));
    form.addAll(Arrays.asList("hello %s", "nick"));

    eval.add(form);
    lwriter.writeForm(eval);
    assertEquals("(jdee-juci-invoke-elisp '(message \"hello %s\" \"nick\"))", output.toString());
  }