Skip to content

Commit

Permalink
#67 - Add a test to validate this bug is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
giraud committed Sep 21, 2018
1 parent e4b521a commit 1224204
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions tests/com/reason/ide/intention/ExpandLocalOpenIntentionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.reason.ide.intention;

import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
import com.reason.ide.files.RmlFileType;

@SuppressWarnings("ConstantConditions")
public class ExpandLocalOpenIntentionTest extends LightPlatformCodeInsightFixtureTestCase {

public void testBasic() {
myFixture.configureByText(RmlFileType.INSTANCE, "Js.Promise.(<caret>Api.all());");
IntentionAction expandAction = myFixture.getAvailableIntention("Expand local open");
myFixture.launchAction(expandAction);

myFixture.checkResult("{ open Js.Promise; Api.all(); };");
}

// https://github.com/reasonml-editor/reasonml-idea-plugin/issues/67
public void testInner() {
myFixture.configureByText(RmlFileType.INSTANCE, "Js.Promise.(<caret>Api.all() |> then_(result => if (!result) { Js.log(result); () }));");
IntentionAction expandAction = myFixture.getAvailableIntention("Expand local open");
myFixture.launchAction(expandAction);

myFixture.checkResult("{ open Js.Promise; Api.all() |> then_(result => if (!result) { Js.log(result); () }); };");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.reason.ide.files.RmlFileType;

@SuppressWarnings("ConstantConditions")
public class FunctionBracesIntention extends LightPlatformCodeInsightFixtureTestCase {
public class FunctionBracesIntentionTest extends LightPlatformCodeInsightFixtureTestCase {
public void testBasic() {
myFixture.configureByText(RmlFileType.INSTANCE, "let add = (x, y) => <caret>x + y;");
IntentionAction bracesAction = myFixture.getAvailableIntention("Add braces to blockless function");
Expand Down

0 comments on commit 1224204

Please sign in to comment.