// Path: tests/org/udalov/jclang/TestUtils.java
// public static void createOrCompare(@NotNull String actual, @NotNull String expectedFileName) {
//     try {
//         String expected = loadFileContents(expectedFileName);
//         assertEquals(expected, actual);
//     }
//     catch (IOException e) {
//         try {
//             PrintWriter out = new PrintWriter(new File(expectedFileName));
//             out.print(actual);
//             out.close();
//             assertEquals("Expected file wasn't found, it will be created", "", actual);
//         }
//         catch (IOException ee) {
//             ee.printStackTrace();
//             fail(ee.getMessage());
//         }
//     }
// }


import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.udalov.jclang.TestUtils.createOrCompare;
                    out.print(" " + attribute.getKind());
                    out.print(" " + attribute.getCursor().getKind());
                    out.println();
                }
            }
        }, getDir() + "objcAttributes.h", new String[]{"-ObjC"});
        out.close();
        createOrCompare(sw.toString(), getDir() + "objcAttributes.txt");
    }

    public void testIndexContainerInfo() {
        StringWriter sw = new StringWriter();
        final PrintWriter out = new PrintWriter(sw);
        Index index = Clang.INSTANCE.createIndex(false, false);
        index.indexSourceFile(new AbstractIndexerCallback() {
            @Override
            public void indexDeclaration(@NotNull DeclarationInfo info) {
                out.println(nonEmptyCursorSpelling(info.getCursor()));
                printContainerCursor(info.getSemanticContainer());
                printContainerCursor(info.getLexicalContainer());
                printContainerCursor(info.getDeclAsContainer());
            }

            private void printContainerCursor(@Nullable ContainerInfo container) {
                if (container == null) return;
                Cursor cursor = container.getCursor();
                out.println("  " + cursor.getKind() + " " + nonEmptyCursorSpelling(cursor));
            }
        }, getDir() + "containerInfo.h", new String[]{"-c", "-x", "c++"});
        out.close();
// Path: tests/org/udalov/jclang/TestUtils.java
// public static void createOrCompare(@NotNull String actual, @NotNull String expectedFileName) {
//     try {
//         String expected = loadFileContents(expectedFileName);
//         assertEquals(expected, actual);
//     }
//     catch (IOException e) {
//         try {
//             PrintWriter out = new PrintWriter(new File(expectedFileName));
//             out.print(actual);
//             out.close();
//             assertEquals("Expected file wasn't found, it will be created", "", actual);
//         }
//         catch (IOException ee) {
//             ee.printStackTrace();
//             fail(ee.getMessage());
//         }
//     }
// }


// Path: tests/org/udalov/jclang/IndexTest.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.udalov.jclang.TestUtils.createOrCompare;

                    out.print(" " + attribute.getKind());
                    out.print(" " + attribute.getCursor().getKind());
                    out.println();
                }
            }
        }, getDir() + "objcAttributes.h", new String[]{"-ObjC"});
        out.close();
        createOrCompare(sw.toString(), getDir() + "objcAttributes.txt");
    }

    public void testIndexContainerInfo() {
        StringWriter sw = new StringWriter();
        final PrintWriter out = new PrintWriter(sw);
        Index index = Clang.INSTANCE.createIndex(false, false);
        index.indexSourceFile(new AbstractIndexerCallback() {
            @Override
            public void indexDeclaration(@NotNull DeclarationInfo info) {
                out.println(nonEmptyCursorSpelling(info.getCursor()));
                printContainerCursor(info.getSemanticContainer());
                printContainerCursor(info.getLexicalContainer());
                printContainerCursor(info.getDeclAsContainer());
            }

            private void printContainerCursor(@Nullable ContainerInfo container) {
                if (container == null) return;
                Cursor cursor = container.getCursor();
                out.println("  " + cursor.getKind() + " " + nonEmptyCursorSpelling(cursor));
            }
        }, getDir() + "containerInfo.h", new String[]{"-c", "-x", "c++"});
        out.close();
        createOrCompare(sw.toString(), getDir() + "containerInfo.txt");