Exemplo n.º 1
0
 def test_relocate_package(self):
   self.assertEqual(('com.foo.bar.**', '{}com.foo.bar.@1'.format(Shading.SHADE_PREFIX)),
                    Shading.create_relocate_package('com.foo.bar'))
   self.assertEqual(('com.foo.bar.*', '{}com.foo.bar.@1'.format(Shading.SHADE_PREFIX)),
                    Shading.create_relocate_package('com.foo.bar', recursive=False))
   self.assertEqual(('com.foo.bar.**', '__p__.com.foo.bar.@1'),
                    Shading.create_relocate_package('com.foo.bar', shade_prefix='__p__.'))
Exemplo n.º 2
0
 def test_relocate_package(self):
   self.assertEqual(('com.foo.bar.**', '{}com.foo.bar.@1'.format(Shading.SHADE_PREFIX)),
                    Shading.create_relocate_package('com.foo.bar'))
   self.assertEqual(('com.foo.bar.*', '{}com.foo.bar.@1'.format(Shading.SHADE_PREFIX)),
                    Shading.create_relocate_package('com.foo.bar', recursive=False))
   self.assertEqual(('com.foo.bar.**', '__p__.com.foo.bar.@1'),
                    Shading.create_relocate_package('com.foo.bar', shade_prefix='__p__.'))
Exemplo n.º 3
0
 def test_relocate_package(self):
     self.assertEqual(
         ("com.foo.bar.**", "{}com.foo.bar.@1".format(Shading.SHADE_PREFIX)),
         Shading.create_relocate_package("com.foo.bar"),
     )
     self.assertEqual(
         ("com.foo.bar.*", "{}com.foo.bar.@1".format(Shading.SHADE_PREFIX)),
         Shading.create_relocate_package("com.foo.bar", recursive=False),
     )
     self.assertEqual(
         ("com.foo.bar.**", "__p__.com.foo.bar.@1"),
         Shading.create_relocate_package("com.foo.bar", shade_prefix="__p__."),
     )
Exemplo n.º 4
0
 def test_relocate_package(self):
     self.assertEqual(
         ("com.foo.bar.**", f"{Shading.SHADE_PREFIX}com.foo.bar.@1"),
         Shading.create_relocate_package("com.foo.bar"),
     )
     self.assertEqual(
         ("com.foo.bar.*", f"{Shading.SHADE_PREFIX}com.foo.bar.@1"),
         Shading.create_relocate_package("com.foo.bar", recursive=False),
     )
     self.assertEqual(
         ("com.foo.bar.**", "__p__.com.foo.bar.@1"),
         Shading.create_relocate_package("com.foo.bar",
                                         shade_prefix="__p__."),
     )
Exemplo n.º 5
0
 def test_rules_file(self):
   expected = [
     'rule a.b.c.** d.e.f.@1\n',
     'rule a.*.b [email protected]\n',
     'rule x.y.z.** shaded.x.y.z.@1\n',
     'zap com.foo.bar.Main\n',
     'zap com.baz.*\n',
     'keep org.foobar.vegetable.Potato\n',
     'keep org.foobar.fruit.**\n',
   ]
   rules = [
     Shading.create_relocate('a.b.c.**', 'd.e.f.@1'),
     Shading.create_relocate('a.*.b', shade_prefix='shaded.'),
     Shading.create_relocate_package('x.y.z', shade_prefix='shaded.'),
     Shading.create_zap('com.foo.bar.Main'),
     Shading.create_zap_package('com.baz', recursive=False),
     Shading.create_keep('org.foobar.vegetable.Potato'),
     Shading.create_keep_package('org.foobar.fruit'),
   ]
   with self.shader.temporary_rules_file(rules) as fname:
     with open(fname, 'r') as f:
       received = f.readlines()
       self.assertEqual(received, expected)
Exemplo n.º 6
0
 def test_rules_file(self):
     expected = [
         'rule a.b.c.** d.e.f.@1\n',
         'rule a.*.b [email protected]\n',
         'rule x.y.z.** shaded.x.y.z.@1\n',
         'zap com.foo.bar.Main\n',
         'zap com.baz.*\n',
         'keep org.foobar.vegetable.Potato\n',
         'keep org.foobar.fruit.**\n',
     ]
     rules = [
         Shading.create_relocate('a.b.c.**', 'd.e.f.@1'),
         Shading.create_relocate('a.*.b', shade_prefix='shaded.'),
         Shading.create_relocate_package('x.y.z', shade_prefix='shaded.'),
         Shading.create_zap('com.foo.bar.Main'),
         Shading.create_zap_package('com.baz', recursive=False),
         Shading.create_keep('org.foobar.vegetable.Potato'),
         Shading.create_keep_package('org.foobar.fruit'),
     ]
     with self.shader.temporary_rules_file(rules) as fname:
         with open(fname, 'r') as f:
             received = f.readlines()
             self.assertEqual(received, expected)
Exemplo n.º 7
0
 def test_rules_file(self):
     expected = [
         "rule a.b.c.** d.e.f.@1\n",
         "rule a.*.b [email protected]\n",
         "rule x.y.z.** shaded.x.y.z.@1\n",
         "zap com.foo.bar.Main\n",
         "zap com.baz.*\n",
         "keep org.foobar.vegetable.Potato\n",
         "keep org.foobar.fruit.**\n",
     ]
     rules = [
         Shading.create_relocate("a.b.c.**", "d.e.f.@1"),
         Shading.create_relocate("a.*.b", shade_prefix="shaded."),
         Shading.create_relocate_package("x.y.z", shade_prefix="shaded."),
         Shading.create_zap("com.foo.bar.Main"),
         Shading.create_zap_package("com.baz", recursive=False),
         Shading.create_keep("org.foobar.vegetable.Potato"),
         Shading.create_keep_package("org.foobar.fruit"),
     ]
     with self.shader.temporary_rules_file(rules) as fname:
         with open(fname, "r") as f:
             received = f.readlines()
             self.assertEqual(received, expected)
Exemplo n.º 8
0
 def test_rules_file(self):
     expected = [
         "rule a.b.c.** d.e.f.@1\n",
         "rule a.*.b [email protected]\n",
         "rule x.y.z.** shaded.x.y.z.@1\n",
         "zap com.foo.bar.Main\n",
         "zap com.baz.*\n",
         "keep org.foobar.vegetable.Potato\n",
         "keep org.foobar.fruit.**\n",
     ]
     rules = [
         Shading.create_relocate("a.b.c.**", "d.e.f.@1"),
         Shading.create_relocate("a.*.b", shade_prefix="shaded."),
         Shading.create_relocate_package("x.y.z", shade_prefix="shaded."),
         Shading.create_zap("com.foo.bar.Main"),
         Shading.create_zap_package("com.baz", recursive=False),
         Shading.create_keep("org.foobar.vegetable.Potato"),
         Shading.create_keep_package("org.foobar.fruit"),
     ]
     with self.shader.temporary_rules_file(rules) as fname:
         with open(fname, "r") as f:
             received = f.readlines()
             self.assertEqual(received, expected)