z124_quotes_quoteFold_tst.java 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. XOWA: the XOWA Offline Wiki Application
  3. Copyright (C) 2012-2017 gnosygnu@gmail.com
  4. XOWA is licensed under the terms of the General Public License (GPL) Version 3,
  5. or alternatively under the terms of the Apache License Version 2.0.
  6. You may use XOWA according to either of these licenses as is most appropriate
  7. for your project on a case-by-case basis.
  8. The terms of each license can be found in the source code repository:
  9. GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
  10. Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
  11. */
  12. package gplx.gfml; import gplx.*;
  13. import org.junit.*;
  14. public class z124_quotes_quoteFold_tst {
  15. GfmlParse_fxt fx = GfmlParse_fxt.new_();
  16. @Before public void setup() {
  17. fx.ini_RootLxr_Add
  18. ( GfmlDocLxrs.NdeInline_lxr()
  19. , GfmlDocLxrs.QuoteFold_lxr()
  20. );
  21. }
  22. @Test public void Quote() {
  23. fx.tst_Doc("^'a b'^;", fx.nde_().Atru_("a b"));
  24. }
  25. @Test public void Tab() {
  26. fx.tst_Doc("^'a\tb'^;", fx.nde_().Atru_("ab"));
  27. fx.tst_Tkn("^'a\tb'^;"
  28. , fx.tkn_grp_
  29. ( fx.tkn_grp_
  30. ( fx.tkn_grp_ary_("^'", "a", "\t", "b", "'^"))
  31. , fx.tkn_itm_(";"))
  32. );
  33. }
  34. @Test public void NewLine() {
  35. fx.tst_Doc(String_.Concat("^'a", String_.CrLf, "b'^;"), fx.nde_().Atru_("ab"));
  36. }
  37. @Test public void Eval() {
  38. fx.tst_Doc("^'a<~t>b'^;", fx.nde_().Atru_("a\tb"));
  39. }
  40. @Test public void Nest() {
  41. fx.tst_Doc("^'a^'-'^b'^;", fx.nde_().Atru_("a-b"));
  42. }
  43. @Test public void EscapeBgn() {
  44. fx.tst_Doc("^'a^'^'b'^;", fx.nde_().Atru_("a^'b"));
  45. }
  46. @Test public void EscapeEnd() {
  47. fx.tst_Doc("^'a'^'^b'^;", fx.nde_().Atru_("a'^b"));
  48. }
  49. @Test public void Comment0() {
  50. fx.tst_Doc(String_.Concat("^'a//comment", String_.CrLf, "b'^;"), fx.nde_().Atru_("ab"));
  51. }
  52. @Test public void Comment1() {
  53. fx.tst_Doc("^'a/*comment*/b'^;", fx.nde_().Atru_("ab"));
  54. }
  55. }