Skip to content

Commit 99b4e87

Browse files
committed
Bytecode Tests - add doclet type resolution tests
We could use more for Java Doc types, but at least now this ensures the GetDocletType can handle both directories and paths.
1 parent 60f154e commit 99b4e87

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/Xamarin.Android.Tools.Bytecode/Tests/ParameterFixupTests.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,48 @@ public void XmlDeclaration_DoesNotThrowAnExceptionIfDocumentationNotFound ()
5858
Assert.Fail ("An unexpected exception was thrown : {0}", ex);
5959
}
6060
}
61+
62+
[Test]
63+
public void DocletType_ShouldDetectApiXml ()
64+
{
65+
string tempFile = null;
66+
67+
try {
68+
tempFile = LoadToTempFile ("ParameterFixupApiXmlDocs.xml");
69+
70+
AssertDocletType (tempFile, Bytecode.JavaDocletType._ApiXml);
71+
} catch (Exception ex) {
72+
try {
73+
if (File.Exists (tempFile))
74+
File.Delete (tempFile);
75+
}
76+
catch { }
77+
78+
Assert.Fail ("An unexpected exception was thrown : {0}", ex);
79+
}
80+
}
81+
82+
[Test]
83+
public void DocletType_ShouldDetectDroidDocs ()
84+
{
85+
var androidSdkPath = Environment.GetEnvironmentVariable ("ANDROID_SDK_PATH");
86+
if (string.IsNullOrEmpty (androidSdkPath)) {
87+
Assert.Ignore("The `ANDROID_SDK_PATH` environment variable isn't set; " +
88+
"cannot test importing parameter names from HTML. Skipping...");
89+
return;
90+
}
91+
92+
try {
93+
var droidDocsPath = Path.Combine (androidSdkPath, "docs", "reference");
94+
95+
if (!Directory.Exists (droidDocsPath))
96+
Assert.Fail("The Android SDK Documentation path `{0}` was not found.", droidDocsPath);
97+
98+
AssertDocletType (droidDocsPath, Bytecode.JavaDocletType.DroidDoc2);
99+
} catch (Exception ex) {
100+
Assert.Fail("An unexpected exception was thrown : {0}", ex);
101+
}
102+
}
61103
}
62104
}
63105

0 commit comments

Comments
 (0)