@Test
public void testMetadata() throws Exception { testMetadata$(); }
public void testMetadata$() throws Exception {
testSourceProcessing("#", "foo1 ## #error_EXP(asfd,3,4){xxx}==",
checkMD("foo1 # xxx==", new MetadataEntry("error_EXP", "asfd,3,4", "xxx", 7))
);
testSourceProcessing("#",
"asdf ## #error(info1)==",
checkMD("asdf # ==", new MetadataEntry("error", "info1", null, 7))
);
testSourceProcessing("#",
"asdf ## #error==",
checkMD("asdf # ==", new MetadataEntry("error", null, null, 7))
);
testSourceProcessing("#",
"asdf ## #error{xxx}==",
checkMD("asdf # xxx==", new MetadataEntry("error", null, "xxx", 7))
);
// Source not included
testSourceProcessing("#",
"asdf ## #error¤{xxx}==",
checkMD("asdf # ==", new MetadataEntry("error", null, "xxx", 7, false))
);
testSourceProcessing("#", "badsyntax #foo()¤", 17);
testSourceProcessing("#", "badsyntax #fooxx¤", 17);
testSourceProcessing("#",
"foo1 ## #error_EXP:asfd_ad{xxx}==",
checkMD("foo1 # xxx==", new MetadataEntry("error_EXP", "asfd_ad", "xxx", 7))
);
testSourceProcessing("#",
"asdf ## #error:info1==",
checkMD("asdf # ==", new MetadataEntry("error", "info1", null, 7))
);
// Syntax errors
testSourceProcessing("#", "badsyntax #foo(=={", 18);
testSourceProcessing("#", "badsyntax #foo(==){asdf", 18+5);
testSourceProcessing("#", "badsyntax #foo(==#:SPLIT\n)", 17);
testSourceProcessing("#", "badsyntax #foo(==#:END:", 18);
testSourceProcessing("#", "badsyntax #foo(){xxx#:SPLIT\n)", 17+3);
testSourceProcessing("#", "badsyntax #foo(){xxx#:END:", 17+3+2+3);
for (int i = 0; i < TemplatedSourceProcessorParser.OPEN_DELIMS.length; i++) {
String open = TemplatedSourceProcessorParser.OPEN_DELIMS[i];
String close = TemplatedSourceProcessorParser.CLOSE_DELIMS[i];
if(open.equals("{"))
continue;
testSourceProcessing("#", prepString("asdf #foo(arg)►,}◙► #◄,xxx}◄==", open, close),
checkMD(prepString("asdf ,}◙► ◄,xxx}==", open, close),
new MetadataEntry("foo", "arg", prepString(",}◙► ◄,xxx}", open, close), 5))
);
}
//multineLine MD syntax
testSourceProcessing("#",
"multilineMD #error(arg1,arg2,arg3): blah",
checkMD("multilineMD ", new MetadataEntry("error", "arg1,arg2,arg3", " blah", 12, false))
);
// boundary
testSourceProcessing("#",
"multilineMD---#error(arg1,arg2,arg3):\n",
checkMD("multilineMD---", new MetadataEntry("error", "arg1,arg2,arg3", "", 14, false))
);
// #:END: delim
testSourceProcessing("#",
"multilineMD #error(arg1,arg2,arg3):\n line1\nline2\nline3\n#:END:lineOther4\n",
checkMD("multilineMD lineOther4\n",
new MetadataEntry("error", "arg1,arg2,arg3", " line1\nline2\nline3\n", 12, false))
);
testSourceProcessing("#",
"multilineMD #error(arg1,arg2,arg3):line0\nline1\nline2\nline3#:END:afterEnd\nlineOther4\n",
checkMD("multilineMD afterEnd\nlineOther4\n",
new MetadataEntry("error", "arg1,arg2,arg3", "line0\nline1\nline2\nline3", 12, false))
);
// split interaction
testSourceProcessing("#",
"multilineMD #error(arg1,arg2,arg3):\n line1\nline2\nline3\n#:SPLIT:\nlineOther4\n",
checkMD("multilineMD ",
new MetadataEntry("error", "arg1,arg2,arg3", " line1\nline2\nline3\n", 12, false)),
checkMD("lineOther4\n")
);
// ► interaction
testSourceProcessing("#",
"foo1 ## #MD(ab►c●d)【x►x●x】==",
checkMD("foo1 # x►x●x==", new MetadataEntry("MD", "ab►c●d", "x►x●x", 7))
);
}