Examples of GoFile


Examples of ro.redeul.google.go.lang.psi.GoFile

public class GoPsiStatementsTest extends GoPsiTestCase {

    public void testReturnNothing() throws Exception {

        GoFile file = get(parse("package main; func a() { return }"));
        GoFunctionDeclaration func = childAt(0,
                                             file.getFunctions());
        GoBlockStatement blockStmt = get(func.getBlock());
        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class,
                   0, blockStmt.getStatements());
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile

        assertTrue(returnStmt.getExpressions().length == 0);
    }

    public void testReturnLiteral() throws Exception {

        GoFile file = get(parse("package main; func a() { return 1}"));
        GoFunctionDeclaration func = childAt(0,
                                             file.getFunctions());
        GoBlockStatement blockStmt = get(func.getBlock());
        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class,
                   0, blockStmt.getStatements());
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile

                             0, returnStmt.getExpressions()));
    }

    public void testReturnMultiple() throws Exception {

        GoFile file = get(parse("package main; func a() { return 1,2}"));

        GoFunctionDeclaration func =
            childAt(0, file.getFunctions());

        GoBlockStatement blockStmt = get(func.getBlock());

        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class, 0, blockStmt.getStatements());
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile

            castAs(GoLiteralExpression.class, 1, returnStmt.getExpressions()));
    }

    public void testReturnLiteral2() throws Exception {

        GoFile file = get(parse("package main; func a() { return \"a\";\n}"));
        GoFunctionDeclaration func = childAt(0,
                                             file.getFunctions());
        GoBlockStatement blockStmt = get(func.getBlock());
        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class,
                   0, blockStmt.getStatements());
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile

                             0, returnStmt.getExpressions()));
    }

    public void testReturnAddExpression() throws Exception {

        GoFile file = get(parse("package main; func a() { return 1+2 }"));
        GoFunctionDeclaration func = childAt(0,
                                             file.getFunctions());
        GoBlockStatement blockStmt = get(func.getBlock());
        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class,
                   0, blockStmt.getStatements());
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile

import static ro.redeul.google.go.util.GoPsiTestUtils.getAs;

public class GoPsiSliceExpressionsTestCase extends GoPsiTestCase {

    public void testNormalSlice() throws Exception {
        GoFile file = get(parse("package main; func a() { a[i:j] }"));

        GoSliceExpression sliceExpression =
            getAs(GoSliceExpression.class,
                  castAs(GoExpressionStatement.class, 0,
                         get(
                             childAt(0,
                                     file.getFunctions()
                             ).getBlock()
                         ).getStatements()
                  ).getExpression()
            );
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile

        assertEquals("i", get(sliceExpression.getFirstIndex()).getText());
        assertEquals("j", get(sliceExpression.getSecondIndex()).getText());
    }

    public void testNormalNewSlice() throws Exception {
        GoFile file = get(parse("package main; func a() { a[i:j:k] }"));

        GoSliceExpression sliceExpression =
                getAs(GoSliceExpression.class,
                        castAs(GoExpressionStatement.class, 0,
                                get(
                                        childAt(0,
                                                file.getFunctions()
                                        ).getBlock()
                                ).getStatements()
                        ).getExpression()
                );
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile

        assertEquals("j", get(sliceExpression.getSecondIndex()).getText());
        assertEquals("k", get(sliceExpression.getCapacity()).getText());
    }

    public void testEmptySlice() throws Exception {
        GoFile file = get(parse("package main; func a() { a[:] }"));


        GoSliceExpression sliceExpression =
            getAs(GoSliceExpression.class,
                  castAs(GoExpressionStatement.class, 0,
                         get(
                             childAt(0,
                                     file.getFunctions()
                             ).getBlock()
                         ).getStatements()
                  ).getExpression()
            );
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile

        assertNull(sliceExpression.getSecondIndex());
        assertNull(sliceExpression.getCapacity());
    }

    public void testSliceFirstIndex() throws Exception {
        GoFile file = get(parse("package main; func a() { a[i:] }"));


        GoSliceExpression sliceExpression =
            getAs(GoSliceExpression.class,
                  castAs(GoExpressionStatement.class, 0,
                         get(
                             childAt(0,
                                     file.getFunctions()
                             ).getBlock()
                         ).getStatements()
                  ).getExpression()
            );
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.GoFile

        assertNull(sliceExpression.getSecondIndex());
        assertNull(sliceExpression.getCapacity());
    }

    public void testSliceSecondIndex() throws Exception {
        GoFile file = get(parse("package main; func a() { a[:j] }"));


        GoSliceExpression sliceExpression =
            getAs(GoSliceExpression.class,
                  castAs(GoExpressionStatement.class, 0,
                         get(
                             childAt(0,
                                     file.getFunctions()
                             ).getBlock()
                         ).getStatements()
                  ).getExpression()
            );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.