z121_quotes_quotes0_tst.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 z121_quotes_quotes0_tst {
  15. GfmlParse_fxt fx = GfmlParse_fxt.new_();
  16. @Before public void setup() {
  17. fx.ini_RootLxr_Add
  18. ( GfmlDocLxrs.NdeInline_lxr()
  19. , GfmlDocLxrs.Quote0_lxr()
  20. );
  21. }
  22. @Test public void Basic() {
  23. fx.tst_Doc("'abc';", fx.nde_().Atru_("abc"));
  24. fx.tst_Tkn("'abc';"
  25. , fx.tkn_grp_
  26. ( fx.tkn_grp_
  27. ( fx.tkn_grp_ary_("'", "abc", "'"))
  28. , fx.tkn_itm_(";")
  29. )
  30. );
  31. }
  32. @Test public void Escape() {
  33. fx.tst_Doc("'a''b';", fx.nde_().Atru_("a'b"));
  34. fx.tst_Tkn("'a''b';"
  35. , fx.tkn_grp_
  36. ( fx.tkn_grp_
  37. ( fx.tkn_grp_ary_("'", "a", "''", "b", "'"))
  38. , fx.tkn_itm_(";")
  39. )
  40. );
  41. }
  42. @Test public void ManyAtrs_LastQuoted() { // bugfix
  43. fx.ini_RootLxr_Add(GfmlDocLxrs.Whitespace_lxr());
  44. fx.tst_Doc("a 'b';", fx.nde_().Atru_("a").Atru_("b"));
  45. }
  46. }