MCPcopy Create free account
hub / github.com/davidkingzyb/SCAST / testES5

Function testES5

test/test.js:62–105  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

60
61
62function testES5(t){
63
64 if(t=='for'){
65 for(i=0; i<=10; i++){
66 if(i%2==1)continue
67 console.log('for',i)
68 }
69 }else if(t=='while'){
70 let i=0;
71 while(true){
72 i++
73 if(i>10)break
74 }
75 }else if(t=='do'){
76 do{
77 console.log(a)
78 }while(a<10);
79 }else{
80 console.log('other')
81 }
82
83 switch(t){
84 case "forin":
85 for(let k in {'a':'aa','b':'bb','c':'cc'}){
86 console.log(k)
87 }
88 break
89 case "forof":
90 for (let x of ['a','b','c']) {
91 console.log(x);
92 }
93 break
94 default:
95 console.log('switch default t')
96 }
97
98 try{
99 throw new Error('test throw')
100 }catch(err){
101 console.warn('err',err)
102 }
103
104 return 'ok'
105}
106
107testES5('for')

Callers 1

test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected