z181_ndeDots_basic_tst.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 z181_ndeDots_basic_tst {
  15. GfmlParse_fxt fx = GfmlParse_fxt.new_();
  16. @Before public void setup() {
  17. fx.ini_RootLxr_Add
  18. ( GfmlDocLxrs.NdeDot_lxr()
  19. , GfmlDocLxrs.NdeInline_lxr()
  20. , GfmlDocLxrs.NdeBodyBgn_lxr()
  21. , GfmlDocLxrs.NdeBodyEnd_lxr()
  22. );
  23. }
  24. @Test public void One() {
  25. fx.tst_Doc("{a.b;c;}"
  26. , fx.nde_().ChainId_(0).Subs_
  27. ( fx.nde_().Hnd_("a").ChainId_(1).Subs_
  28. ( fx.nde_().Hnd_("b").ChainId_(1)
  29. )
  30. , fx.nde_().Atru_("c").ChainId_(0)
  31. ));
  32. fx.tst_Tkn("{a.b;c;}"
  33. , fx.tkn_grp_
  34. ( fx.tkn_itm_("{")
  35. , fx.tkn_grp_
  36. ( fx.tkn_itm_("a")
  37. , fx.tkn_itm_(".")
  38. , fx.tkn_grp_
  39. ( fx.tkn_itm_("b")
  40. , fx.tkn_itm_(";"))
  41. )
  42. , fx.tkn_grp_
  43. ( fx.tkn_grp_ary_("c")
  44. , fx.tkn_itm_(";"))
  45. , fx.tkn_itm_("}")
  46. ));
  47. }
  48. @Test public void Many() {
  49. fx.tst_Doc("{a.b.c.d;e;}"
  50. , fx.nde_().ChainId_(0).Subs_
  51. ( fx.nde_().Hnd_("a").ChainId_(1).Subs_
  52. ( fx.nde_().Hnd_("b").ChainId_(1).Subs_
  53. ( fx.nde_().Hnd_("c").ChainId_(1).Subs_
  54. ( fx.nde_().Hnd_("d").ChainId_(1)
  55. )))
  56. , fx.nde_().ChainId_(0).Atru_("e")
  57. ));
  58. }
  59. }