2021-11-28 13:16:54 +00:00
|
|
|
/*
|
|
|
|
XOWA: the XOWA Offline Wiki Application
|
|
|
|
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
|
|
|
|
|
|
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
|
|
|
or alternatively under the terms of the Apache License Version 2.0.
|
|
|
|
|
|
|
|
You may use XOWA according to either of these licenses as is most appropriate
|
|
|
|
for your project on a case-by-case basis.
|
|
|
|
|
|
|
|
The terms of each license can be found in the source code repository:
|
|
|
|
|
|
|
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
|
|
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|
|
|
*/
|
2021-12-19 21:19:19 +00:00
|
|
|
package gplx.gfml;
|
|
|
|
import gplx.frameworks.tests.GfoTstr;
|
2018-07-01 11:55:55 +00:00
|
|
|
import org.junit.*;
|
|
|
|
public class z017_GfmlStringHighlighter_tst {
|
2021-11-28 13:16:54 +00:00
|
|
|
@Test public void Short() {
|
2018-07-01 11:55:55 +00:00
|
|
|
tst_Err(sh_().Raw_("a=").Mark_(1, '=', "key tkn").Mark_(2, '?', "EOS:missing data")
|
|
|
|
, "< >"
|
|
|
|
, " a= "
|
|
|
|
, " =?"
|
|
|
|
, ""
|
|
|
|
, "[1] = key tkn"
|
|
|
|
, "[2] ? EOS:missing data"
|
|
|
|
);
|
|
|
|
}
|
2021-11-28 13:16:54 +00:00
|
|
|
@Test public void Whitespace() {
|
2018-07-01 11:55:55 +00:00
|
|
|
tst_Err(sh_().Raw_("a\t\nb").Mark_(0, ' ', "")
|
|
|
|
, "< tn >"
|
|
|
|
, " a b "
|
|
|
|
, " "
|
|
|
|
);
|
|
|
|
}
|
2021-11-28 13:16:54 +00:00
|
|
|
@Test public void Long() {
|
2018-07-01 11:55:55 +00:00
|
|
|
tst_Err(sh_().Raw_("abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba").Mark_(0, '{', "bgn").Mark_(50, '}', "end")
|
|
|
|
, "< >"
|
|
|
|
, " abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba "
|
|
|
|
, " { } "
|
|
|
|
, ""
|
|
|
|
, "[00] { bgn"
|
|
|
|
, "[50] } end"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
GfmlStringHighlighter sh_() {return GfmlStringHighlighter.new_();}
|
|
|
|
void tst_Err(GfmlStringHighlighter sh, String... expdLines) {
|
|
|
|
String[] actlLines = sh.Gen();
|
2021-12-19 21:19:19 +00:00
|
|
|
GfoTstr.EqLines(expdLines, actlLines);
|
2018-07-01 11:55:55 +00:00
|
|
|
}
|
|
|
|
}
|