z151_ndeSubs_basic_tst.java 1.5 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 z151_ndeSubs_basic_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. );
  21. }
  22. @Test public void Basic() {
  23. fx.tst_Doc("{}", fx.nde_());
  24. fx.tst_Tkn("{}"
  25. , fx.tkn_grp_ary_("{", "}")
  26. );
  27. }
  28. @Test public void Many() {
  29. fx.tst_Doc("{}{}", fx.nde_(), fx.nde_());
  30. }
  31. @Test public void Nested() {
  32. fx.tst_Doc("{{}}"
  33. , fx.nde_().Subs_
  34. ( fx.nde_())
  35. );
  36. }
  37. @Test public void NestedMany() {
  38. fx.tst_Doc("{{}{}}"
  39. , fx.nde_().Subs_
  40. ( fx.nde_()
  41. , fx.nde_()
  42. ));
  43. }
  44. @Test public void Complex() {
  45. fx.tst_Doc(String_.Concat
  46. ( "{"
  47. , "{"
  48. , "{}"
  49. , "}"
  50. , "{}"
  51. , "}"
  52. )
  53. , fx.nde_().Subs_
  54. ( fx.nde_().Subs_
  55. ( fx.nde_())
  56. , fx.nde_()
  57. ));
  58. }
  59. }