class CSharpFormatCheckTest(CheckTestCase): check = CSharpFormatCheck() def setUp(self): super(CSharpFormatCheckTest, self).setUp() self.test_highlight = ( 'c-sharp-format', '{0}string{1}', [(0, 3, u'{0}'), (9, 12, u'{1}')], ) def test_no_format(self): self.assertFalse(self.check.check_format( 'strins', 'string', False )) def test_escaping_no_position(self): self.assertFalse(self.check.check_format( '{{ string }}', 'string', False )) def test_simple_format(self): self.assertFalse(self.check.check_format( '{0} strins', '{0} string', False )) def test_format_with_width(self): self.assertFalse(self.check.check_format( '{0,1} strins', '{0,1} string', False )) def test_format_with_flag(self): self.assertFalse(self.check.check_format( '{0:C2} strins', '{0:C2} string', False )) def test_full_format(self): self.assertFalse(self.check.check_format( '{0,1:N0} strins', '{0,1:N0} string', False )) def test_missing_format(self): self.assertTrue(self.check.check_format( '{0} strins', 'string', False )) def test_missing_width_format(self): self.assertTrue(self.check.check_format( '{0,1} strins', 'string', False )) def test_missing_flag_format(self): self.assertTrue(self.check.check_format( '{0:C1} strins', 'string', False )) def test_missing_full_format(self): self.assertTrue(self.check.check_format( '{0,1:C3} strins', 'string', False )) def test_wrong_format(self): self.assertTrue(self.check.check_format( '{0} string', '{1} string', False )) def test_missing_named_format_ignore(self): self.assertFalse(self.check.check_format( '{0} string', 'string', True )) def test_escaping_with_position(self): self.assertFalse(self.check.check_format( '{{ 0 }}', 'string', False )) def test_wrong_attribute_format(self): self.assertTrue(self.check.check_format( '{0} string', '{1} string', False )) def test_reordered_format(self): self.assertFalse(self.check.check_format( '{0} string {1}', '{1} string {0}', False ))
class CSharpFormatCheckTest(CheckTestCase): check = CSharpFormatCheck() def setUp(self): super().setUp() self.test_highlight = ( "c-sharp-format", "{0}string{1}", [(0, 3, "{0}"), (9, 12, "{1}")], ) def test_no_format(self): self.assertFalse(self.check.check_format("strins", "string", False)) def test_escaping_no_position(self): self.assertFalse( self.check.check_format("{{ string }}", "string", False)) def test_simple_format(self): self.assertFalse( self.check.check_format("{0} strins", "{0} string", False)) def test_format_with_width(self): self.assertFalse( self.check.check_format("{0,1} strins", "{0,1} string", False)) def test_format_with_flag(self): self.assertFalse( self.check.check_format("{0:C2} strins", "{0:C2} string", False)) def test_full_format(self): self.assertFalse( self.check.check_format("{0,1:N0} strins", "{0,1:N0} string", False)) def test_missing_format(self): self.assertTrue(self.check.check_format("{0} strins", "string", False)) def test_missing_width_format(self): self.assertTrue( self.check.check_format("{0,1} strins", "string", False)) def test_missing_flag_format(self): self.assertTrue( self.check.check_format("{0:C1} strins", "string", False)) def test_missing_full_format(self): self.assertTrue( self.check.check_format("{0,1:C3} strins", "string", False)) def test_wrong_format(self): self.assertTrue( self.check.check_format("{0} string", "{1} string", False)) def test_missing_named_format_ignore(self): self.assertFalse(self.check.check_format("{0} string", "string", True)) def test_escaping_with_position(self): self.assertFalse(self.check.check_format("{{ 0 }}", "string", False)) def test_wrong_attribute_format(self): self.assertTrue( self.check.check_format("{0} string", "{1} string", False)) def test_reordered_format(self): self.assertFalse( self.check.check_format("{0} string {1}", "{1} string {0}", False))