Skip to content

Commit

Permalink
Further simplify testing setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed Feb 13, 2023
1 parent 0755f54 commit fff2b03
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public BugPatternTestDocumentation extract(ClassTree tree, Context context) {
scanner.getReplacementTests());
}

// XXX: Further improve the heuristics for determining what a BugPattern test is.
@Override
public boolean canExtract(ClassTree tree, VisitorState state) {
String className = tree.getSimpleName().toString();
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "IdentityConversion",
"name": "TestChecker",
"identificationTests": [
"public final class A {\n public void m() {\n // BUG: Diagnostic contains:\n Boolean b = Boolean.valueOf(Boolean.FALSE);\n}\n}\n"
"class A {}\n"
],
"replacementTests": [
{
"inputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet<Object> set = ImmutableSet.copyOf(ImmutableSet.of());\n }\n}\n",
"outputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet<Object> set = ImmutableSet.of();\n }\n}\n"
"inputLines": "class A {}\n",
"outputLines": "class A {}\n"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "IdentityConversion",
"name": "TestChecker",
"identificationTests": [
"public final class B {}\n",
"public final class A {}\n"
"class B {}\n",
"class A {}\n"
],
"replacementTests": []
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "IdentityConversion",
"name": "TestChecker",
"identificationTests": [
"public final class A {\n public void m() {\n // BUG: Diagnostic contains:\n Boolean b = Boolean.valueOf(Boolean.FALSE);\n}\n}\n"
"class A {}\n"
],
"replacementTests": []
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "IdentityConversion",
"name": "TestChecker",
"identificationTests": [],
"replacementTests": []
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "IdentityConversion",
"name": "TestChecker",
"identificationTests": [
"public final class A {\n public void m() {\n // BUG: Diagnostic contains:\n Boolean b = Boolean.valueOf(Boolean.FALSE);\n}\n}\n",
"public final class B {\n public void m() {\n // BUG: Diagnostic contains:\n Boolean b = Boolean.valueOf(Boolean.FALSE);\n}\n}\n"
"class A {}\n",
"class B {}\n"
],
"replacementTests": [
{
"inputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet<Object> set = ImmutableSet.copyOf(ImmutableSet.of());\n }\n}\n",
"outputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet<Object> set = ImmutableSet.of();\n }\n}\n"
"inputLines": "class A {}\n",
"outputLines": "class A {}\n"
},
{
"inputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class B {\n public void m() {\n ImmutableSet<Object> set = ImmutableSet.copyOf(ImmutableSet.of());\n }\n}\n",
"outputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class B {\n public void m() {\n ImmutableSet<Object> set = ImmutableSet.of();\n }\n}\n"
"inputLines": "class B {}\n",
"outputLines": "class B {}\n"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "IdentityConversion",
"name": "TestChecker",
"identificationTests": [],
"replacementTests": [
{
"inputLines": "public final class A {}\n",
"inputLines": "class A {}\n",
"outputLines": ""
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "IdentityConversion",
"name": "TestChecker",
"identificationTests": [],
"replacementTests": [
{
"inputLines": "public final class B {}\n",
"outputLines": "public final class B {}\n"
"inputLines": "class B {}\n",
"outputLines": "class B {}\n"
},
{
"inputLines": "public final class A {}\n",
"outputLines": "public final class A {}\n"
"inputLines": "class A {}\n",
"outputLines": "class A {}\n"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "IdentityConversion",
"name": "TestChecker",
"identificationTests": [],
"replacementTests": [
{
"inputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet<Object> set = ImmutableSet.copyOf(ImmutableSet.of());\n }\n}\n",
"outputLines": "import com.google.common.collect.ImmutableSet;\n\npublic final class A {\n public void m() {\n ImmutableSet<Object> set = ImmutableSet.of();\n }\n}\n"
"inputLines": "class A {}\n",
"outputLines": "class A {}\n"
}
]
}

0 comments on commit fff2b03

Please sign in to comment.