首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Clojure的测试框架 基于测试的开发方式: 美的测试框架有利于驱动项目的开发,当编写代码前写了测试代码,那么就非常有利于开发人员集中精力,着力于当前待解决的

2012-12-28 
Clojure的测试框架 基于测试的开发方式: 好的测试框架有利于驱动项目的开发,当编写代码前写了测试代码,那

Clojure的测试框架 基于测试的开发方式: 好的测试框架有利于驱动项目的开发,当编写代码前写了测试代码,那么就非常有利于开发人员集中精力,着力于当前待解决的

<!--[endif]--><!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter" /> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0" /> <v:f eqn="sum @0 1 0" /> <v:f eqn="sum 0 0 @1" /> <v:f eqn="prod @2 1 2" /> <v:f eqn="prod @3 21600 pixelWidth" /> <v:f eqn="prod @3 21600 pixelHeight" /> <v:f eqn="sum @0 0 1" /> <v:f eqn="prod @6 1 2" /> <v:f eqn="prod @7 21600 pixelWidth" /> <v:f eqn="sum @8 21600 0" /> <v:f eqn="prod @7 21600 pixelHeight" /> <v:f eqn="sum @10 21600 0" /> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" /> <o:lock v:ext="edit" aspectratio="t" /></v:shapetype><![endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK1'><span style='mso-bookmark:OLE_LINK2'></span></span></span></span><v:shape id="_x0000_i1025" type="#_x0000_t75" style='width:177.95pt;height:60.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK1'><span style='mso-bookmark:OLE_LINK2'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span></span></span><![endif]-->

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'></span></span><v:shape id="_x0000_i1026" type="#_x0000_t75" style='width:361.7pt;height:105.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span><![endif]-->

is宏有两个特殊的断言形式,用以测试异常。
<!--[if !supportLists]-->Clojure的测试框架 基于测试的开发方式: 美的测试框架有利于驱动项目的开发,当编写代码前写了测试代码,那么就非常有利于开发人员集中精力,着力于当前待解决的? <!--[endif]-->"(is (thrown? c ...))"形式测试是否有一个类c的异常抛出。例如:
<!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK5'><span style='mso-bookmark:OLE_LINK6'></span></span></span></span><spanstyle='mso-element:field-begin;mso-field-lock:yes'></span><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK5'><span style='mso-bookmark:OLE_LINK6'><spanlang=EN-US style='font-size:9.0pt'> SHAPE <span style='mso-spacerun:yes'>?</span>\* MERGEFORMAT <spanstyle='mso-element:field-separator'></span></span></span></span></span></span><![endif]--><!--[if gte vml 1]><v:rect id="_x0000_s1038" style='width:235.7pt;height:30.3pt;flip:x;mso-wrap-style:none; mso-wrap-distance-top:7.2pt;mso-wrap-distance-bottom:36pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line' o:allowincell="f" fillcolor="white [3201]" strokecolor="#c2d69b [1942]" strokeweight="1pt"> <v:fill color2="#d6e3bc [1302]" focusposition="1" focussize="" focus="100%"  type="gradient" /> <v:stroke dashstyle="1 1" endcap="round" /> <v:shadow on="t" type="perspective" color="#4e6128 [1606]" opacity=".5"  offset="1pt" offset2="-3pt" /> <v:textbox style='mso-next-textbox:#_x0000_s1038;mso-fit-shape-to-text:t'  inset="2.5mm,2.5mm,2.5mm,7.2pt">  <![if !mso]>  <table cellpadding=0 cellspacing=0 width="100%">   <tr>    <td><![endif]>    <div>    <p class=MsoNormal style='text-indent:0cm;mso-char-indent-count:0'><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:#CC7A7A;    mso-font-kerning:0pt'>(</span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#7F0055;mso-font-kerning:0pt'>is</span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:black;    mso-font-kerning:0pt'> </span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#CCB07A;mso-font-kerning:0pt'>(</span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:#7F0055;    mso-font-kerning:0pt'>thrown?</span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:black;mso-font-kerning:0pt'> <i>ArithmeticException</i> </span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:#7ACC7A;    mso-font-kerning:0pt'>(</span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#7F0055;mso-font-kerning:0pt'>/</span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:black;    mso-font-kerning:0pt'> 1 0</span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#7ACC7A;mso-font-kerning:0pt'>)</span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:#CCB07A;    mso-font-kerning:0pt'>)</span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#CC7A7A;mso-font-kerning:0pt'>)</span><span    lang=EN-US style='mso-bidi-font-size:14.0pt'><o:p></o:p></span></p>    </div>    <![if !mso]></td>   </tr>  </table>  <![endif]></v:textbox> <w:wrap type="none" anchorx="page" anchory="page" /> <w:anchorlock /></v:rect><![endif]--><!--[if !vml]-->Clojure的测试框架 基于测试的开发方式: 美的测试框架有利于驱动项目的开发,当编写代码前写了测试代码,那么就非常有利于开发人员集中精力,着力于当前待解决的<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK5'><span style='mso-bookmark:OLE_LINK6'></span></span></span></span><v:shape id="_x0000_i1028" type="#_x0000_t75" style='width:235.7pt;height:30.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK5'><span style='mso-bookmark:OLE_LINK6'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span></span></span><![endif]-->
<!--[if !supportLists]-->Clojure的测试框架 基于测试的开发方式: 美的测试框架有利于驱动项目的开发,当编写代码前写了测试代码,那么就非常有利于开发人员集中精力,着力于当前待解决的? <!--[endif]-->"(is (thrown-with-msg? c re ...))"做着同样的事情,不同的是会检测异常消息是否和正则表达式re匹配。例如:
<!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'></span></span><spanstyle='mso-element:field-begin;mso-field-lock:yes'></span><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanlang=EN-US style='font-size:9.0pt'> SHAPE <span style='mso-spacerun:yes'>?</span>\* MERGEFORMAT <spanstyle='mso-element:field-separator'></span></span></span></span><![endif]--><!--[if gte vml 1]><v:rect id="_x0000_s1037" style='width:324.95pt;height:45.3pt;flip:x;mso-wrap-style:none; mso-wrap-distance-top:7.2pt;mso-wrap-distance-bottom:36pt; mso-position-horizontal-relative:char;mso-position-vertical-relative:line' o:allowincell="f" fillcolor="white [3201]" strokecolor="#c2d69b [1942]" strokeweight="1pt"> <v:fill color2="#d6e3bc [1302]" focusposition="1" focussize="" focus="100%"  type="gradient" /> <v:stroke dashstyle="1 1" endcap="round" /> <v:shadow on="t" type="perspective" color="#4e6128 [1606]" opacity=".5"  offset="1pt" offset2="-3pt" /> <v:textbox style='mso-next-textbox:#_x0000_s1037;mso-fit-shape-to-text:t'  inset="2.5mm,2.5mm,2.5mm,7.2pt">  <![if !mso]>  <table cellpadding=0 cellspacing=0 width="100%">   <tr>    <td><![endif]>    <div>    <p class=MsoNormal align=left style='text-align:left;text-indent:0cm;    mso-char-indent-count:0;mso-layout-grid-align:none;text-autospace:none'><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:#CC7A7A;    mso-font-kerning:0pt'>(</span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#7F0055;mso-font-kerning:0pt'>is</span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:black;    mso-font-kerning:0pt'> </span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#CCB07A;mso-font-kerning:0pt'>(</span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:#7F0055;    mso-font-kerning:0pt'>thrown-with-msg?</span><span lang=EN-US    style='font-size:10.0pt;font-family:Consolas;color:black;mso-font-kerning:    0pt'> <i>ArithmeticException</i> </span><span lang=EN-US style='font-size:    10.0pt;font-family:Consolas;color:#2A00FF;mso-font-kerning:0pt'>#&quot;Divide by zero&quot;</span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;mso-font-kerning:    0pt'><o:p></o:p></span></p>    <p class=MsoNormal style='text-indent:20.0pt'><span lang=EN-US    style='font-size:10.0pt;font-family:Consolas;color:black;mso-font-kerning:    0pt'><span style='mso-spacerun:yes'>????????????????????? </span></span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:#7ACC7A;    mso-font-kerning:0pt'>(</span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#7F0055;mso-font-kerning:0pt'>/</span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:black;    mso-font-kerning:0pt'> 1 0</span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#7ACC7A;mso-font-kerning:0pt'>)</span><span    lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:#CCB07A;    mso-font-kerning:0pt'>)</span><span lang=EN-US style='font-size:10.0pt;    font-family:Consolas;color:#CC7A7A;mso-font-kerning:0pt'>)</span><span    lang=EN-US style='mso-bidi-font-size:14.0pt'><o:p></o:p></span></p>    </div>    <![if !mso]></td>   </tr>  </table>  <![endif]></v:textbox> <w:wrap type="none" anchorx="page" anchory="page" /> <w:anchorlock /></v:rect><![endif]--><!--[if !vml]-->Clojure的测试框架 基于测试的开发方式: 美的测试框架有利于驱动项目的开发,当编写代码前写了测试代码,那么就非常有利于开发人员集中精力,着力于当前待解决的<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'></span></span><v:shape id="_x0000_i1027" type="#_x0000_t75" style='width:324.95pt;height:45.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span><![endif]-->

<!--[if !supportLists]-->第二章<!--[endif]-->给测试单元添加说明文档

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'></span></span><v:shape id="_x0000_i1029" type="#_x0000_t75" style='width:366.95pt;height:105.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span><![endif]-->

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK7'><span style='mso-bookmark:OLE_LINK8'></span></span></span></span><v:shape id="_x0000_i1030" type="#_x0000_t75" style='width:271.7pt;height:240.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK7'><span style='mso-bookmark:OLE_LINK8'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span></span></span><![endif]-->

<!--[if !supportLists]-->第三章<!--[endif]-->定义单元测试

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK9'><span style='mso-bookmark:OLE_LINK10'></span></span></span></span><v:shape id="_x0000_i1031" type="#_x0000_t75" style='width:176.45pt;height:90.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK9'><span style='mso-bookmark:OLE_LINK10'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span></span></span><![endif]-->

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK11'><span style='mso-bookmark:OLE_LINK12'></span></span></span></span><v:shape id="_x0000_i1032" type="#_x0000_t75" style='width:144.2pt;height:120.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK11'><span style='mso-bookmark:OLE_LINK12'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span></span></span><![endif]-->

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'></span></span><v:shape id="_x0000_i1033" type="#_x0000_t75" style='width:114.95pt;height:60.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span><![endif]-->

<!--[if !supportLists]-->第四章<!--[endif]-->运行单元测试代码

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK15'><span style='mso-bookmark:OLE_LINK16'></span></span></span></span><v:shape id="_x0000_i1034" type="#_x0000_t75" style='width:272.45pt;height:30.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK35'><span style='mso-bookmark:OLE_LINK36'><spanstyle='mso-bookmark:OLE_LINK15'><span style='mso-bookmark:OLE_LINK16'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span></span></span><![endif]-->

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'></span></span><v:shape id="_x0000_i1035" type="#_x0000_t75" style='width:198.95pt;height:30.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span><![endif]-->

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'><spanstyle='mso-bookmark:OLE_LINK21'><span style='mso-bookmark:OLE_LINK22'></span></span></span></span><v:shape id="_x0000_i1036" type="#_x0000_t75" style='width:264.95pt;height:90.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'><spanstyle='mso-bookmark:OLE_LINK21'><span style='mso-bookmark:OLE_LINK22'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span></span></span><![endif]-->

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'><spanstyle='mso-bookmark:OLE_LINK23'><span style='mso-bookmark:OLE_LINK24'></span></span></span></span><v:shape id="_x0000_i1037" type="#_x0000_t75" style='width:235.7pt;height:30.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'><spanstyle='mso-bookmark:OLE_LINK23'><span style='mso-bookmark:OLE_LINK24'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span></span></span><![endif]-->

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'></span></span><v:shape id="_x0000_i1038" type="#_x0000_t75" style='width:293.45pt;height:30.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span><![endif]-->

<!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><spanstyle='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'></span></span><v:shape id="_x0000_i1039" type="#_x0000_t75" style='width:235.7pt;height:30.3pt'> <v:imagedata croptop="-65520f" cropbottom="65520f" /></v:shape><span style='mso-bookmark:OLE_LINK36'><span style='mso-bookmark:OLE_LINK35'><spanlang=EN-US style='font-size:9.0pt'><span style='mso-element:field-end'></span></span></span></span><![endif]-->

?

热点排行