diff --git a/tests/com/reason/ide/intention/FunctionBracesIntention.java b/tests/com/reason/ide/intention/FunctionBracesIntention.java new file mode 100644 index 000000000..6255b00e7 --- /dev/null +++ b/tests/com/reason/ide/intention/FunctionBracesIntention.java @@ -0,0 +1,22 @@ +package com.reason.ide.intention; + +import com.intellij.codeInsight.intention.IntentionAction; +import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; +import com.reason.ide.files.RmlFileType; + +public class FunctionBracesIntention extends LightPlatformCodeInsightFixtureTestCase { + public void testBasic() { + myFixture.configureByText(RmlFileType.INSTANCE, "let add = (x, y) => x + y;"); + IntentionAction bracesAction = (IntentionAction) myFixture.getAvailableIntention("Add braces to blockless function"); + myFixture.launchAction(bracesAction); + myFixture.checkResult("let add = (x, y) => { x + y; };"); + } + + // https://github.com/reasonml-editor/reasonml-idea-plugin/issues/67 + public void testInnerFunction() { + myFixture.configureByText(RmlFileType.INSTANCE, "Js.Promise.( Api.all() |> then_(result => Js.log(result)) );"); + IntentionAction bracesAction = (IntentionAction) myFixture.getAvailableIntention("Add braces to blockless function"); + // myFixture.launchAction(bracesAction); + // myFixture.checkResult("Js.Promise.( Api.all() |> then_(result => { Js.log(result); }) );"); + } +} \ No newline at end of file