Doctest.js是JavaScript的测试框架。
示例测试代码:
functioncapitalize(words){returnwords.replace(/\b[a-z]/g,function(m){returnm[0].toUpperCase();});}print(capitalize('somewords'));//=>SomeWordsprint(capitalize('some4wardwords'));//=>Some4wardWordsDoctest.js是JavaScript的测试框架。
示例测试代码:
functioncapitalize(words){returnwords.replace(/\b[a-z]/g,function(m){returnm[0].toUpperCase();});}print(capitalize('somewords'));//=>SomeWordsprint(capitalize('some4wardwords'));//=>Some4wardWords
评论