z451_dflts_compile_tst.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 z451_dflts_compile_tst {
  15. @Before public void setup() {
  16. regy = fx_typ.Regy();
  17. pragma = GfmlPragmaDefault.new_();
  18. fx_typ.run_InitPragma(regy, pragma);
  19. } GfmlTypRegy regy; GfmlPragmaDefault pragma; GfmlDefaultItem_fxt fx = GfmlDefaultItem_fxt.new_(); GfmlTypeCompiler_fxt fx_typ = GfmlTypeCompiler_fxt.new_();
  20. @Test public void Basic() {
  21. GfmlNde gnde = fx_typ.run_Resolve(regy, "_default/type/atr"
  22. , fx_typ.nde_().Atru_("x").Atru_("10")
  23. );
  24. GfmlDefaultItem actl = pragma.CompileItem(gnde, "point");
  25. fx.tst_Item(actl, fx.make_("point", "x", "10"));
  26. }
  27. @Test public void Many() {
  28. GfmlNde gnde = fx_typ.run_Resolve(regy, "_default/type"
  29. , fx_typ.nde_().Atru_("point").Subs_
  30. ( fx_typ.nde_().Atrs_("x", "10")
  31. , fx_typ.nde_().Atrs_("y", "20")
  32. ));
  33. List_adp list = List_adp_.New();
  34. pragma.CompileSubNde(gnde, list);
  35. fx.tst_List(list
  36. , fx.make_("point", "x", "10")
  37. , fx.make_("point", "y", "20")
  38. );
  39. }
  40. }