| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 | /** * Created by Tony on 2017/4/7. */var test = require('tape');var strUtil = require('../../public/stringUtil');//test('some string test cases', function (t) {//    var reg = /^\s*$/;//    var foo = "   ";//    t.equal(reg.test(foo), true);//    foo = null;//    t.equal(reg.test(foo), true);//    foo = undefined;//    t.equal(reg.test(foo), true);//    foo = "";//    t.equal(reg.test(foo), true);//    foo = 0;//    t.equal(reg.test(foo), true);//    t.end();//});////test('check if string type', function(t){//    var foo = "";//    t.equal(typeof foo, 'string');//    foo = " ";//    t.equal(typeof foo, 'string');//    foo = 0;//    t.equal(typeof foo, 'number');//    foo = true;//    t.equal(typeof foo, 'boolean');//    foo = {};//    t.equal(typeof foo, 'object');//    foo = function(){};//    t.equal(typeof foo, 'function');//    foo = [];//    t.equal(Array.isArray(foo), true);//    t.end();//})// test('test number to Chinese', function(t){//     //t.equal(strUtil.convertNumToChinese(1, true), '壹');//     //t.equal(strUtil.convertNumToChinese(1, false), '一');//     t.equal(strUtil.convertNumToChinese(11, false), '一十一');//     t.equal(strUtil.convertNumToChinese(12, false), '一十二');//     t.equal(strUtil.convertNumToChinese(21, false), '二十一');//     //console.log(strUtil.convertNumToChinese(102, false));//     t.equal(strUtil.convertNumToChinese(102, false), '一百零二');//     t.end();// });// test('test 拼音', function(t){//     t.equal(strUtil.getPinYinCamelChars("招标清单"), "ZBQD");//     t.equal(strUtil.getPinYinCamelChars("1. 招标清单"), "1. ZBQD");//     t.end();// })test('test typeof', function(t){    t.equal(typeof(true), "boolean");    t.equal((typeof("abc")).toUpperCase(), "STRING");    t.equal(typeof(1), "number");    t.end();})
 |