You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SubmoduleConfigTest.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 2017, David Pursehouse <david.pursehouse@gmail.com> and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.lib;
  11. import static org.junit.Assert.assertEquals;
  12. import static org.junit.Assert.assertFalse;
  13. import static org.junit.Assert.assertTrue;
  14. import org.eclipse.jgit.lib.SubmoduleConfig.FetchRecurseSubmodulesMode;
  15. import org.junit.Test;
  16. public class SubmoduleConfigTest {
  17. @Test
  18. public void fetchRecurseMatch() throws Exception {
  19. assertTrue(FetchRecurseSubmodulesMode.YES.matchConfigValue("yes"));
  20. assertTrue(FetchRecurseSubmodulesMode.YES.matchConfigValue("YES"));
  21. assertTrue(FetchRecurseSubmodulesMode.YES.matchConfigValue("true"));
  22. assertTrue(FetchRecurseSubmodulesMode.YES.matchConfigValue("TRUE"));
  23. assertTrue(FetchRecurseSubmodulesMode.ON_DEMAND
  24. .matchConfigValue("on-demand"));
  25. assertTrue(FetchRecurseSubmodulesMode.ON_DEMAND
  26. .matchConfigValue("ON-DEMAND"));
  27. assertTrue(FetchRecurseSubmodulesMode.ON_DEMAND
  28. .matchConfigValue("on_demand"));
  29. assertTrue(FetchRecurseSubmodulesMode.ON_DEMAND
  30. .matchConfigValue("ON_DEMAND"));
  31. assertTrue(FetchRecurseSubmodulesMode.NO.matchConfigValue("no"));
  32. assertTrue(FetchRecurseSubmodulesMode.NO.matchConfigValue("NO"));
  33. assertTrue(FetchRecurseSubmodulesMode.NO.matchConfigValue("false"));
  34. assertTrue(FetchRecurseSubmodulesMode.NO.matchConfigValue("FALSE"));
  35. }
  36. @Test
  37. public void fetchRecurseNoMatch() throws Exception {
  38. assertFalse(FetchRecurseSubmodulesMode.YES.matchConfigValue("Y"));
  39. assertFalse(FetchRecurseSubmodulesMode.NO.matchConfigValue("N"));
  40. assertFalse(FetchRecurseSubmodulesMode.ON_DEMAND
  41. .matchConfigValue("ONDEMAND"));
  42. assertFalse(FetchRecurseSubmodulesMode.YES.matchConfigValue(""));
  43. assertFalse(FetchRecurseSubmodulesMode.YES.matchConfigValue(null));
  44. }
  45. @Test
  46. public void fetchRecurseToConfigValue() {
  47. assertEquals("on-demand",
  48. FetchRecurseSubmodulesMode.ON_DEMAND.toConfigValue());
  49. assertEquals("true", FetchRecurseSubmodulesMode.YES.toConfigValue());
  50. assertEquals("false", FetchRecurseSubmodulesMode.NO.toConfigValue());
  51. }
  52. }