@Test
public void layoutFileSuffix() throws Exception {

  File tempDir = Files.createTempDir();
  sourceFile = new File(tempDir, "layout.xml");
  sourceFilePath = sourceFile.getAbsolutePath();
  File source = new File(tempDir, "real-layout.xml");
  Files.write("<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
              "    xmlns:tools=\"http://schemas.android.com/tools\"\n" +
              "    android:layout_width=\"match_parent\"\n" +
              "    android:layout_height=\"match_parent\"\n" +
              "    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n" +
              "    android:paddingRight=\"@dimen/activity_horizontal_margin\"\n" +
              "    android:paddingTop=\"@dimen/activity_vertical_margin\"\n" +
              "    android:paddingBottom=\"@dimen/activity_vertical_margin\"\n" +
              "    tools:context=\".MainActivity\">\n" +
              "\n" +
              "\n" +
              "    <Button\n" +
              "        android:layout_width=\"wrap_content\"\n" +
              "        android:layout_height=\"wrap_content\"\n" +
              "        android:hint=\"fy faen\"\n" +
              "        android:text=\"@string/hello_world\"\n" +
              "        android:slayout_alignParentTop=\"true\"\n" +
              "        android:layout_alignParentLeft=\"true\" />\n" +
              "\n" +
              "</RelativeLayout>\n", source, StandardCharsets.UTF_8);
  source.deleteOnExit();
  Files.write("<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
              "    xmlns:tools=\"http://schemas.android.com/tools\"\n" +
              "    android:layout_width=\"match_parent\"\n" +
              "    android:layout_height=\"match_parent\"\n" +
              "    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n" +
              "    android:paddingRight=\"@dimen/activity_horizontal_margin\"\n" +
              "    android:paddingTop=\"@dimen/activity_vertical_margin\"\n" +
              "    android:paddingBottom=\"@dimen/activity_vertical_margin\"\n" +
              "    tools:context=\".MainActivity\">\n" +
              "\n" +
              "    <!--style=\"@style/Buttons\"-->\n" +
              "    <Button\n" +
              "        android:layout_width=\"wrap_content\"\n" +
              "        android:layout_height=\"wrap_content\"\n" +
              "        android:hint=\"fy faen\"\n" +
              "        android:text=\"@string/hello_world\"\n" +
              "        android:slayout_alignParentTop=\"true\"\n" +
              "        android:layout_alignParentLeft=\"true\" />\n" +
              "\n" +
              "</RelativeLayout>\n" +
              "<!-- " + createPathComment(source, false) + " -->", sourceFile, StandardCharsets.UTF_8);
  String output =
    "Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0\n" +
    ":BlankProject1:preBuild UP-TO-DATE\n" +
    ":BlankProject1:preDebugBuild UP-TO-DATE\n" +
    ":BlankProject1:preReleaseBuild UP-TO-DATE\n" +
    ":BlankProject1:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" +
    ":BlankProject1:prepareDebugDependencies\n" +
    ":BlankProject1:compileDebugAidl UP-TO-DATE\n" +
    ":BlankProject1:compileDebugRenderscript UP-TO-DATE\n" +
    ":BlankProject1:generateDebugBuildConfig UP-TO-DATE\n" +
    ":BlankProject1:mergeDebugAssets UP-TO-DATE\n" +
    ":BlankProject1:mergeDebugResources UP-TO-DATE\n" +
    ":BlankProject1:processDebugManifest UP-TO-DATE\n" +
    ":BlankProject1:processDebugResources\n" +
    sourceFilePath + ":12: error: No resource identifier found for attribute 'slayout_alignParentTop' in package 'android'\n" +
    ":BlankProject1:processDebugResources FAILED\n" +
    "\n" +
    "FAILURE: Build failed with an exception.\n" +
    "\n" +
    "* What went wrong:\n" +
    "Execution failed for task ':BlankProject1:processDebugResources'.\n" +
    "> Failed to run command:\n" +
    "  \t/Users/tnorbye/dev/sdks/build-tools/18.0.1/aapt package -f --no-crunch -I ... " +
    "  Error Code:\n" +
    "  \t1\n" +
    "  Output:\n" +
    "  \t" + sourceFilePath + ":12: error: No resource identifier found for attribute 'slayout_alignParentTop' in package 'android'\n" +
    "\n" +
    "\n" +
    "* Try:\n" +
    "Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\n" +
    "\n" +
    "BUILD FAILED\n";
  assertEquals("0: Simple::BlankProject1:preBuild UP-TO-DATE\n" +
               "1: Simple::BlankProject1:preDebugBuild UP-TO-DATE\n" +
               "2: Simple::BlankProject1:preReleaseBuild UP-TO-DATE\n" +
               "3: Simple::BlankProject1:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" +
               "4: Simple::BlankProject1:prepareDebugDependencies\n" +
               "5: Simple::BlankProject1:compileDebugAidl UP-TO-DATE\n" +
               "6: Simple::BlankProject1:compileDebugRenderscript UP-TO-DATE\n" +
               "7: Simple::BlankProject1:generateDebugBuildConfig UP-TO-DATE\n" +
               "8: Simple::BlankProject1:mergeDebugAssets UP-TO-DATE\n" +
               "9: Simple::BlankProject1:mergeDebugResources UP-TO-DATE\n" +
               "10: Simple::BlankProject1:processDebugManifest UP-TO-DATE\n" +
               "11: Simple::BlankProject1:processDebugResources\n" +
               "12: Error:No resource identifier found for attribute 'slayout_alignParentTop' in package 'android'\n" +
               "\t" + source.getPath() + ":12:-1\n" +
               "13: Simple::BlankProject1:processDebugResources FAILED\n" +
               "14: Error:Error while executing aapt command\n" +
               "15: Error:Execution failed for task ':BlankProject1:processDebugResources'.\n" +
               "16: Info:BUILD FAILED\n",
               toString(parser.parseGradleOutput(output)));
  sourceFile.delete();
  source.delete();
  tempDir.delete();
}