コード例 #1
0
ファイル: test_parsers.py プロジェクト: colossalbit/cssypy
 def test_vardef_at_end2(self):
     src = u'$x: 5 a {}'
     parser = Parser(src)
     self.assertTrue(parser.match(tokens.START))
     with self.assertRaises(errors.CSSSyntaxError) as cm:
         parser.toplevel_statement()
     self.assertEqual("Variable definitions must end with a semicolon.", 
                      cm.exception.msg)
コード例 #2
0
ファイル: test_parsers.py プロジェクト: colossalbit/cssypy
 def test_vardef_at_end1(self):
     # Variable definition at the end of a stylesheet is legal, though 
     # useless.
     src = u'$x: 5'
     parser = Parser(src)
     self.assertTrue(parser.match(tokens.START))
     stmt = parser.toplevel_statement()
     expected = \
         VarDef(
             name=u'x',
             expr=NumberNode(number=u'5')
         )
     self.assertEqual(dump(expected), dump(stmt))