z152_ndeSubs_data_tst.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 z152_ndeSubs_data_tst {
  15. GfmlParse_fxt fx = GfmlParse_fxt.new_();
  16. @Before public void setup() {
  17. fx.ini_RootLxr_Add
  18. ( GfmlDocLxrs.NdeBodyBgn_lxr()
  19. , GfmlDocLxrs.NdeBodyEnd_lxr()
  20. , GfmlDocLxrs.NdeInline_lxr()
  21. , GfmlDocLxrs.Whitespace_lxr()
  22. );
  23. }
  24. @Test public void ToInline() {
  25. fx.tst_Doc("{a;}"
  26. , fx.nde_().Subs_
  27. ( fx.nde_().Atru_("a"))
  28. );
  29. }
  30. @Test public void ToInline_many() {
  31. fx.tst_Doc("{a b;}"
  32. , fx.nde_().Subs_
  33. ( fx.nde_().Atru_("a").Atru_("b"))
  34. );
  35. }
  36. @Test public void ToBody() {
  37. fx.tst_Doc("{a{}}"
  38. , fx.nde_().Subs_
  39. ( fx.nde_().Atru_("a"))
  40. );
  41. }
  42. @Test public void ToBody_many() {
  43. fx.tst_Doc("{a b{}}"
  44. , fx.nde_().Subs_
  45. ( fx.nde_().Atru_("a").Atru_("b"))
  46. );
  47. }
  48. @Test public void ToBody_manyNest() {
  49. fx.tst_Doc("a{b;}"
  50. , fx.nde_().Atru_("a").Subs_
  51. ( fx.nde_().Atru_("b"))
  52. );
  53. }
  54. @Test public void ToBody_many2() {
  55. fx.tst_Doc("a{b{c;}}"
  56. , fx.nde_().Atru_("a").Subs_
  57. ( fx.nde_().Atru_("b").Subs_
  58. ( fx.nde_().Atru_("c"))
  59. )
  60. );
  61. }
  62. }