-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding a test to prove that we can support prettier-plugins now
- Loading branch information
Showing
3 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
testlib/src/main/resources/npm/prettier/plugins/java-test.clean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.function.Consumer; | ||
|
||
public class JavaTest { | ||
private static final String NAME = "JavaTest"; | ||
|
||
private List<String> strings = new ArrayList<>(); | ||
|
||
public JavaTest(String... strings) { | ||
this.strings.addAll(Arrays.asList(strings)); | ||
} | ||
|
||
/** | ||
* Join using char. | ||
* @param joiner the char to use for joining. | ||
* @return the joined string. | ||
*/ | ||
public String join(char joiner) { | ||
return String.join(joiner, strings); | ||
} | ||
|
||
public void operateOn(Consumer<List<String>> consumer) { | ||
// test comment | ||
consumer.accept(strings); | ||
} | ||
|
||
public static void main(String[] args) { | ||
JavaTest javaTest = new JavaTest("1", "2", "3"); | ||
System.out.println("joined: " + javaTest.join(',')); | ||
StringBuilder builder = new StringBuilder(); | ||
javaTest.operateOn( | ||
strings -> builder.append(String.join("---", strings)) | ||
); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
testlib/src/main/resources/npm/prettier/plugins/java-test.dirty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import java.util.ArrayList; | ||
|
||
|
||
import java.util.Arrays;import java.util.List; | ||
import java.util.function.Consumer; | ||
|
||
public class JavaTest { private static final String NAME = "JavaTest"; | ||
|
||
private List<String> strings = new ArrayList<>(); | ||
|
||
public JavaTest( String ... strings) { | ||
this.strings .addAll(Arrays.asList(strings));; | ||
} | ||
|
||
/** | ||
* Join using char. | ||
* @param joiner the char to use for joining. | ||
* @return the joined string. | ||
*/ | ||
public String | ||
join(char joiner ) { | ||
return String.join(joiner, strings); | ||
} | ||
|
||
public void operateOn( Consumer<List<String>> consumer) { | ||
// test comment | ||
consumer.accept( strings); | ||
} | ||
|
||
public static void main(String[] args) {JavaTest javaTest = new JavaTest("1", "2", "3");System.out.println("joined: " + javaTest.join(',' ));StringBuilder builder = new StringBuilder();javaTest.operateOn((strings) -> builder.append(String.join("---", strings)));}} |