Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use current fix examples for tests #633 #665

Merged
merged 5 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Content assist is triggered with Ctrl-Space. The input above is also used in `Fi

Run workflows on the web server, passing `data`, `flux`, and `fix`:

[http://localhost:8080/xtext-service/run?data='1'{'a': '5', 'z': 10}&flux=as-lines|decode-formeta|fix|encode-formeta(style="multiline")&fix=map(a,b) map(\_else)](http://localhost:8080/xtext-service/run?data=%271%27{%27a%27:%20%275%27,%20%27z%27:%2010}&flux=as-lines|decode-formeta|fix|encode-formeta(style=%22multiline%22)&fix=map(a,c)%20map(\_else))
[http://localhost:8080/xtext-service/run?data='1'{'a': '5', 'z': 10}&flux=as-lines|decode-formeta|fix|encode-formeta(style="multiline")&fix=copy_field(a,c)](http://localhost:8080/xtext-service/run?data=%271%27{%27a%27:%20%275%27,%20%27z%27:%2010}&flux=as-lines|decode-formeta|fix|encode-formeta(style=%22multiline%22)&fix=copy_field(a,c))

## Functions and cookbook

Expand Down
26 changes: 14 additions & 12 deletions metafix/src/test/java/org/metafacture/metafix/FixParsingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public FixParsingTest() {
@Test
public void shouldParseSimple() throws Exception {
parse(
"map(a,b)"
"copy_field(a,b)"
);
}

Expand All @@ -41,7 +41,9 @@ public void shouldParseQuotedStrings() throws Exception {
"add_field(hello,\"w-o:r l/d\")",
"add_field(hello,'\tw\n\torld')",
"add_field(hello,'\\tw\\n\\torld')",
"add_field(hello,'\"world\"')"
"add_field(hello,'\"world\"')",
"add_field(\"hello\",world)",
"add_field('hello','world')"
);
}

Expand All @@ -50,17 +52,17 @@ public void shouldParseMappings() throws Exception {
parse(
"# simple field name mappings",
"",
"map(a,b)",
"copy_field(a,b)",
"",
"# nested field structure",
"",
"map(e1)",
"map(e1.e2)",
"map(e1.e2.d)",
"copy_field(e1,f1)",
"copy_field(e1.e2,f1)",
"copy_field(e1.e2.d,f1)",
"",
"# pass-through for unmapped fields",
"# pass-through for fields by default, use retain to only keep certain elements",
"",
"map(_else)",
"retain(f1, b)",
""
);
}
Expand Down Expand Up @@ -90,15 +92,15 @@ public void shouldParseTransformations() throws Exception {
"",
"# Loops",
"",
"do list(path)",
"do list(path:'test')",
"\tadd_field(foo,bar)",
LITERAL_END,
"",
"# Nested expressions",
"",
"do marc_each()",
"\tif marc_has(f700)",
"\t\tmarc_map(f700a,authors.$append)",
"do list(path:'700??','var':'$i')",
"\tif any_match('$i.4','aut')",
"\t\tcopy_field('$i.a','authors.$append')",
"\t" + LITERAL_END,
LITERAL_END,
""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public void shouldInterpretSimple() throws Exception {
@Test
public void shouldInterpretNested() throws Exception {
interpret(3,
"do marc_each()",
"\tif marc_has(f700)",
"\t\tmarc_map(f700a,authors.$append)",
"do list(path:'700??','var':'$i')",
"\tif any_equal('$i.4','aut')",
"\t\tcopy_field($i.a,authors.$append)",
"\tend",
"end",
""
Expand Down
8 changes: 4 additions & 4 deletions misc/vim/syntax/syntax-sample.fix
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ end

# Loops

do list(path)
do list(path:"base")
add_field(foo, bar) and foo.bar(key: "val=$1")
end

# Nested expressions

do marc_each()
if marc_has(f700)
marc_map(f700a, authors.$append.bla, 'bla')
do list(path:"700","var":"$i")
if any_equal("$i.4","aut")
copy_field("$i.a", "authors.$append")
end
end

Expand Down