testnarcissus.py

来自「Harvestman-最新版本」· Python 代码 · 共 39 行

PY
39
字号
"""Simple test script which tests narcissus against all samplejavascript files """from jsparse import print_functionsimport sys, osfcount, passcount = 0, 0oldstdout = sys.stdout# Redirect all output to /dev/nullif os.name == 'posix':    sys.stdout = open('/dev/null','w')else:     sys.stdout = open('.js.tmp','w')skip = ['editor_main.js','bportugal.js']for filename in os.listdir("samples"):    if filename.endswith('.js') and filename not in skip:        print >> sys.stderr, "Filename => " + filename        fcount += 1        try:            print_functions(os.path.join('samples',filename))            passcount += 1        except Exception, e:            print >> sys.stderr, "Error: " + str(e)sys.stdout = oldstdoutif fcount:    print 'Tested with %d samples.' % fcount    if fcount == passcount:        print 'All tests passed'    else:        print '%d tests passed, %d failed' % (passcount, fcount-passcount)            

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?