Package seph.lang

Examples of seph.lang.SephObject


    @Test
    public void parses_a_string_with_a_newline_in_it_correctly() {
        Message result = parse("\"foo\nbar\"");
        assertTrue("Result should be a literal message", result.isLiteral());
        SephObject literal = result.literal();
        assertEquals(Text.class, literal.getClass());
        assertEquals("foo\nbar", ((Text)literal).text());
        assertNull(result.next());
    }
View Full Code Here


    }

    @Test
    public void parses_a_string_with_an_escaped_newline_correctly() {
        Message result = parse("\"foo\\\nbar\"");
        SephObject literal = result.literal();
        assertEquals("foobar", ((Text)literal).text());
    }
View Full Code Here

    @Test
    public void parses_a_string_using_alternative_syntax_correctly() {
        Message result = parse(" %[blargus hello \"something else\" - he]");

        assertTrue("Result should be a literal message", result.isLiteral());
        SephObject literal = result.literal();
        assertEquals(Text.class, literal.getClass());
        assertEquals("blargus hello \"something else\" - he", ((Text)literal).text());
        assertNull(result.next());
    }
View Full Code Here

    @Test
    public void parses_a_regular_expression() {
        Message result = parse(" %/foo/");
        assertTrue("Result should be a literal message", result.isLiteral());
        SephObject literal = result.literal();
        assertEquals(Regexp.class, literal.getClass());
        assertEquals("foo", ((Regexp)literal).pattern());
        assertNull(result.next());
    }
View Full Code Here

    }

    @Test
    public void parses_a_regular_expression_with_flags() {
        Message result = parse(" %/bar/ix");
        SephObject literal = result.literal();
        assertEquals("bar", ((Regexp)literal).pattern());
        assertEquals("ix", ((Regexp)literal).flags());
        assertNull(result.next());
    }
View Full Code Here

    @Test
    public void parses_a_regular_expression_with_alternative_syntax() {
        Message result = parse(" %r[foo]");
        assertTrue("Result should be a literal message", result.isLiteral());
        SephObject literal = result.literal();
        assertEquals(Regexp.class, literal.getClass());
        assertEquals("foo", ((Regexp)literal).pattern());
        assertNull(result.next());
    }
View Full Code Here

    }

    @Test
    public void parses_a_regular_expression_with_flags_with_alternative_syntax() {
        Message result = parse(" %r[bar]mux");
        SephObject literal = result.literal();
        assertEquals("bar", ((Regexp)literal).pattern());
        assertEquals("mux", ((Regexp)literal).flags());
        assertNull(result.next());
    }
View Full Code Here

* @author <a href="mailto:ola.bini@gmail.com">Ola Bini</a>
*/
public class PersistentListTest {
    @Test
    public void first_will_return_the_given_first_value() {
        SephObject expected = new Text("foo");
        assertSame(expected, new PersistentList(expected).first());
    }
View Full Code Here

        assertSame(expected, new PersistentList(expected).first());
    }

    @Test
    public void cons_returns_a_cons_with_first_as_the_object_given() {
        SephObject expected = new Text("foo");
        assertSame(expected, new PersistentList(null).cons(expected).first());
    }
View Full Code Here

        assertEquals(Arrays.<Message>asList(), msg.arguments());
    }

    @Test
    public void with_next_returns_a_new_object_with_the_same_literal() {
        SephObject lit = new Text("bar");
        LiteralMessage msg = new LiteralMessage(lit, null, null, 0, 0);
        assertSame(lit, msg.withNext(null).literal());
    }
View Full Code Here

TOP

Related Classes of seph.lang.SephObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.