def doTest(): text = 'body {width: 1px}' logs, warns, errors = doCssCheck(text) equal(len(logs), 2, 'two logs') equal(len(warns), 1, 'one warn happened') equal(len(errors), 1, 'one error happened') equal(fill(warns[0]), r'each rule in "body" need semicolon in the end, "width" has not', 'warn rule text is ok') equal(fill(errors[0]), r'should not set style for html tag in "body"', 'error rule text is ok')
def doTest(): logs, warns, errors = doCssTextCheck('/* @author: zhifu.wang**/ /* .test {width: 100px;}*/', 'test.css') equal(len(errors), 1, 'one error occur') equal(fill(errors[0]), 'empty css file "test.css"') logs, warns, errors = doCssTextCheck('/* @author: zhifu.wang**/ /* .test {width: 100px;}*/ \n.test { width: 100px; }', 'test.css') equal(len(errors), 0, 'no error now')
def doTest(): logs, warns, errors = doCssTextCheck( '/* @author: zhifu.wang**/ /* .test {width: 100px;}*/', 'test.css') equal(len(errors), 1, 'one error occur') equal(fill(errors[0]), 'empty css file "test.css"') logs, warns, errors = doCssTextCheck( '/* @author: zhifu.wang**/ /* .test {width: 100px;}*/ \n.test { width: 100px; }', 'test.css') equal(len(errors), 0, 'no error now')
def checkUnitTestResult(expecteds, reals, level, fileName): global okCounter global errorCounter for real in reals: real = fill(real) real = real.split('(from "')[0].strip() if expecteds.has_key(real): okCounter = okCounter + 1 expecteds[real] = 0 else: errorCounter = errorCounter + 1 console.show('[UnitTest] [unexpected but has] level ' + level + '( ' + real + ' )' + ' in ' + fileName) for key, value in expecteds.items(): if value == 1: errorCounter = errorCounter + 1 console.show('[UnitTest] [expect but has not] level ' + level + '( ' + key + ' )' + ' in ' + fileName)