@Test public void testParseSymbol2() { final SymbolLiteralNode _node; _node = ((SymbolLiteralNode) Parser.factory.source_("#foo").parseExpression()); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), SymbolLiteralNode.factory)); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_( _node.value(), st.gravel.core.Symbol.value("foo"))); }
@Test public void testParse2ArgBlockEmpty2() { final Statement _node; _node = Parser.factory.source_("[:a :b ]").parseExpression(); assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory)); assertEquals((String) "[:a :b | ]", (String) _node.prettySourceString()); }
@Test public void testParseNilaryBlockNoTemps() { final Statement _node; _node = Parser.factory.source_("[1 foo. 2 bar]").parseExpression(); assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory)); assertEquals((String) "\n[\n1 foo.\n2 bar]", (String) _node.prettySourceString()); }
@Test public void testParseVariableDot() { final BlockNode _node; _node = ((BlockNode) Parser.factory.source_(" [foo. bar] ").parseExpression()); assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory)); assertEquals((String) "\n[\nfoo.\nbar]", (String) _node.prettySourceString()); }
@Test public void testAssignmentExpressionInBlock() { final Statement _node; _node = Parser.factory.source_("[ foo := 7 ]").parseStatement(); assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory)); assertEquals((String) "[foo := 7]", (String) _node.prettySourceString()); }
@Test public void testParse2ArgBlockNoTempsDotEnd() { final Statement _node; _node = Parser.factory.source_("[:a :b | a foo. b bar.]").parseExpression(); assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory)); assertEquals((String) "\n[:a :b | \na foo.\nb bar]", (String) _node.prettySourceString()); }
@Test public void testParseKeywordMethod2() { final KeywordMethodNode _node; _node = ((KeywordMethodNode) Parser.factory.parseMethod_("foo: arg1 bar: arg2 ^bar")); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), KeywordMethodNode.factory)); assertEquals((String) "foo: arg1 bar: arg2\n\t^bar", (String) _node.prettySourceString()); }
@Test public void testParseString2() { final StringLiteralNode _node; _node = ((StringLiteralNode) Parser.factory.source_("\'from\'\'age\'").parseExpression()); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), StringLiteralNode.factory)); assertTrue(st.gravel.support.jvm.StringExtensions.equals_(_node.value(), "from\'age")); }
@Test public void testParseOrType() { final BinaryMethodNode _node; _node = ((BinaryMethodNode) Parser.factory.parseMethod_("+ arg {String | Nil} ^bar")); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BinaryMethodNode.factory)); assertEquals((String) "+ arg {String | Nil}\n\t^bar", (String) _node.prettySourceString()); }
@Test public void testParseBinaryExpression() { final Statement _node; _node = Parser.factory.source_(" 3 + 7 ").parseExpression(); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BinaryMessageNode.factory)); assertEquals((String) "3 + 7", (String) _node.prettySourceString()); }
@Test public void testParseVariable() { final VariableNode _node; _node = ((VariableNode) Parser.factory.source_(" foo ").parseExpression()); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), VariableNode.factory)); assertEquals((String) "foo", (String) _node.prettySourceString()); }
@Test public void testParseUnaryMethod() { final UnaryMethodNode _node; _node = ((UnaryMethodNode) Parser.factory.parseMethod_("foo self baz. ^bar")); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), UnaryMethodNode.factory)); assertEquals((String) "foo\n\tself baz.\n\t^bar", (String) _node.prettySourceString()); }
@Test public void testParseMethodWithArgType() { final BinaryMethodNode _node; _node = ((BinaryMethodNode) Parser.factory.parseMethod_("+ arg {String} ^bar")); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BinaryMethodNode.factory)); assertEquals((String) "+ arg {String}\n\t^bar", (String) _node.prettySourceString()); assertTrue(_node.argument().type() != null); assertTrue(_node.returnType() == null); }
@Test public void testParseChar() { final CharacterLiteralNode _node; _node = ((CharacterLiteralNode) Parser.factory.source_("$a").parseExpression()); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_( _node.factory(), CharacterLiteralNode.factory)); assertEquals((String) "$a", (String) _node.prettySourceString()); assertTrue(st.gravel.support.jvm.CharacterExtensions.equals_(_node.value(), 'a')); }
@Test public void testParseByteArray() { final ByteArrayLiteralNode _node; _node = ((ByteArrayLiteralNode) Parser.factory.source_("#[1 2 3]").parseExpression()); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_( _node.factory(), ByteArrayLiteralNode.factory)); assertEquals((String) "#[1 2 3]", (String) _node.prettySourceString()); assertTrue( st.gravel.support.jvm.ByteArrayExtensions.equals_(_node.value(), new byte[] {1, 2, 3})); }
@Test public void testParseLiteralArray() { final ArrayLiteralNode _node; _node = ((ArrayLiteralNode) Parser.factory .source_("#(#foo foo \'foo\' 1 (a b c) #( a b c) ((x)) () #[1 2 3])") .parseExpression()); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), ArrayLiteralNode.factory)); assertEquals( (String) "#(#foo #foo \'foo\' 1 #(#a #b #c) #(#a #b #c) #(#(#x)) #() #[1 2 3])", (String) _node.prettySourceString()); assertTrue(st.gravel.support.jvm.IntegerExtensions.equals_(_node.value().length, 9)); }
@Test public void testParseKeywordBinaryUnaryExpression4() { final Statement _node; _node = Parser.factory .source_( "2 + 7 bar foo: 7 bar: 4 baz foo: 2 + 1 boo: 3 foo + 2 roo: 3 + 2 foo noo: 3 hoo + 2 joo") .parseExpression(); assertTrue( st.gravel.support.jvm.ObjectExtensions.equals_( _node.factory(), KeywordMessageNode.factory)); assertEquals( (String) "2 + 7 bar\n\tfoo: 7\n\tbar: 4 baz\n\tfoo: 2 + 1\n\tboo: 3 foo + 2\n\troo: 3 + 2 foo\n\tnoo: 3 hoo + 2 joo", (String) _node.prettySourceString()); }