Skip to content

Commit

Permalink
Copy values in fix-list-values to support wildcard & index paths
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed May 8, 2023
1 parent 5927b7c commit 1d0fe7b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@
public class MetafixListValues extends MetafixStreamAnalyzer {

public MetafixListValues(final String path) {
super("retain(\"" + path + "\")", Compare.OBJECT, "${o}\t ${s}", "${o}");
super(fix(path), Compare.OBJECT, "${o}\t ${s}", "${o}");
}

private static String fix(final String path) {
return
"copy_field(\"" + path + "\",\"value.$append\")\n" +
"retain(\"value\")";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,48 @@ public MetafixListValuesTest() {
}

@Test
public void testShouldListPathsA() {
public void testShouldListPathsSimple() {
lister = new MetafixListValues("a");
verify("2\t aA");
}

@Test
public void testShouldListPathsB() {
public void testShouldListPathsWildcard() {
lister = new MetafixListValues("a.*");
verify("2\t aA");
}

@Test
public void testShouldListPathsIndex() {
lister = new MetafixListValues("a.1");
verify("1\t aA");
}

@Test
public void testShouldListPathsTwoValues() {
lister = new MetafixListValues("b");
verify(
"2\t bB",
"1\t bA");
}

@Test
public void testShouldListPathsTwoValuesWildcard() {
lister = new MetafixListValues("b.*");
verify(
"2\t bB",
"1\t bA");
}

@Test
public void testShouldListPathsC() {
public void testShouldListPathsTwoValuesIndex() {
lister = new MetafixListValues("b.1");
verify(
"1\t bB");
}

@Test
public void testShouldListPathsSortCount() {
lister = new MetafixListValues("c");
verify(
"3\t cC",
Expand Down

0 comments on commit 1d0fe7b

Please sign in to comment.