Skip to content

Commit 52ad84c

Browse files
committed
Fix tests on windows
1 parent 4c669ec commit 52ad84c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tests/com/goide/GoSdkServiceTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.intellij.openapi.util.SystemInfo;
2323
import com.intellij.openapi.util.io.FileUtil;
2424
import com.intellij.openapi.util.text.StringUtil;
25+
import com.intellij.testFramework.PlatformTestUtil;
2526
import com.intellij.testFramework.UsefulTestCase;
2627
import org.jetbrains.annotations.NotNull;
2728

@@ -34,49 +35,49 @@ public class GoSdkServiceTest extends UsefulTestCase {
3435
public void testRegularSdkPath() {
3536
setIsWindows(false);
3637
setIsLinux(false);
37-
assertEquals("/path/to/sdk/bin/go", getExecutablePath("/path/to/sdk"));
38+
PlatformTestUtil.assertPathsEqual("/path/to/sdk/bin/go", executable("/path/to/sdk"));
3839
}
3940

4041
public void testRegularSdkPathWithGorootName() {
4142
setIsWindows(false);
4243
setIsLinux(false);
4344
String sdkPath = createDir("goroot/").getAbsolutePath();
44-
assertEquals(sdkPath + "/goroot/bin/go", getExecutablePath(sdkPath + "/goroot"));
45+
PlatformTestUtil.assertPathsEqual(sdkPath + "/goroot/bin/go", executable(sdkPath + "/goroot"));
4546
}
4647

4748
public void testSingletonAppEngineSdkPath() {
4849
setIsWindows(false);
4950
String sdkPath = createDir("goroot/", "goapp").getAbsolutePath();
50-
assertEquals(sdkPath + "/goapp", getExecutablePath(sdkPath + "/goroot"));
51+
PlatformTestUtil.assertPathsEqual(sdkPath + "/goapp", executable(sdkPath + "/goroot"));
5152
}
5253

5354
public void testGcloudAppEngineSdkPath() {
5455
setIsWindows(false);
5556
String sdkPath = createDir("platform/google_appengine/goroot/", "bin/goapp").getAbsolutePath();
56-
assertEquals(sdkPath + "/bin/goapp", getExecutablePath(sdkPath + "/platform/google_appengine/goroot"));
57+
PlatformTestUtil.assertPathsEqual(sdkPath + "/bin/goapp", executable(sdkPath + "/platform/google_appengine/goroot"));
5758
}
5859

5960
public void testRegularSdkPathWindows() {
6061
setIsWindows(true);
6162
setIsLinux(false);
6263
String sdkPath = createDir("platform/google_appengine/goroot/", "bin/goapp").getAbsolutePath();
63-
assertEquals(sdkPath + "/bin/go.exe", getExecutablePath(sdkPath));
64+
PlatformTestUtil.assertPathsEqual(sdkPath + "/bin/go.exe", executable(sdkPath));
6465
}
6566

6667
public void testSingletonAppEngineSdkPathWindows() {
6768
setIsWindows(true);
6869
String sdkPath = createDir("goroot/", "goapp.bat").getAbsolutePath();
69-
assertEquals(sdkPath + "/goapp.bat", getExecutablePath(sdkPath + "/goroot"));
70+
PlatformTestUtil.assertPathsEqual(sdkPath + "/goapp.bat", executable(sdkPath + "/goroot"));
7071
}
7172

7273
public void testGcloudAppEngineSdkPathWindows() {
7374
setIsWindows(true);
7475
String sdkPath = createDir("platform/google_appengine/goroot/", "bin/goapp.cmd").getAbsolutePath();
75-
assertEquals(sdkPath + "/bin/goapp.cmd", getExecutablePath(sdkPath + "/platform/google_appengine/goroot"));
76+
PlatformTestUtil.assertPathsEqual(sdkPath + "/bin/goapp.cmd", executable(sdkPath + "/platform/google_appengine/goroot"));
7677
}
7778

78-
private static String getExecutablePath(@NotNull String sdkPath) {
79-
return FileUtil.toSystemIndependentName(GoSdkService.getGoExecutablePath(sdkPath));
79+
private static String executable(@NotNull String sdkPath) {
80+
return GoSdkService.getGoExecutablePath(sdkPath);
8081
}
8182

8283
private void setIsWindows(boolean value) {

0 commit comments

Comments
 (0)