From 77e9b13733ca0efb2802482400c2117f539d96a0 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sat, 14 Jan 2017 16:47:03 -0500 Subject: [PATCH 01/17] created tscns --- scenes/main.scn | Bin 1135 -> 547 bytes scenes/main.tscn | 10 ++++++++++ test/gut/gut_main.scn | Bin 1138 -> 549 bytes test/gut/gut_main.tscn | 10 ++++++++++ 4 files changed, 20 insertions(+) create mode 100644 scenes/main.tscn create mode 100644 test/gut/gut_main.tscn diff --git a/scenes/main.scn b/scenes/main.scn index 64818e2d01dcc374dc4f60912cb0a6c1f3a844cb..b287810158e02577c2ea68a28bf8418caaa271af 100644 GIT binary patch delta 346 zcmWmAu};EJ6oBE=7NuHJNeodMVvaFxOsD~!PDNu(gcw*{%f}OL z9Y|b_Z(vdeH%Dj1C(t)g_#faK{vZ7*wo$1Ti!dn(u%Q7MDu4peRY1jQPzD+#FrGN% zZe4g)S4aW(lku89NstXUut=DhHm(?Kn9wa0?`w zadyGOvlc9&NkApgQIB^-v*ia8Y{M?o0_A4hKuYEYZ5cWiL1a0lkz&y+S#&$y;Z2{* zuzNyfSi}NosEwh|C<|#!dUK2k&kutpyJ)meeaV&`RS1bgDt)UpGP#LwY6}oIX#jr% zh>ppmOX370&4_IJ=-Oi~1@oxWoxy7j!F<^YxpdJRu0{urZol_`wXELN_6q4FCi*L} WeCo)A{oV4;%eHd^P^ngmlcE13oM0dT delta 959 zcmWktU1%I-6umRwY<4$I(#3R5cFoo=+ioe?NJx`Lf=Tb}Y&W(KC2SHztIju>{dRYB zcV?ZL-Tbt$TMM=d6>3n3KXq$BeNdqms-=iS0xD7;d=h^iMv+-_%ppv_rkg7 zoD1h}N`FKq3-gKscPa+390hn-0uTV&0*LJ{0R&2*hmzhoO@E3P=XGv!_&h>m7bXr0 z=PnqNE&L7%BruI6%wzUq_xc!0>JQDeKjC)r0K!!eesobh0L zKR!-x&|WV})0JX$1P|A(j+ui>?k!^t8b1+8lYY``H}3S4?ruSm!z_O~puCQGe5qS+IIdMwHM{Jv ze%zKu7OHfwQxP$v{EfLE;K6`#@Mcd-(rwPoeJ!N9*4v+9AO4cR6?_Gy+57_h*8zE7 z0PMrpf|S6K3GW_Ho?U3mLEcj=g4fqKg#%$O&OVS({$2lCn2hs2IC|uG?)@x#2B0us IQ0{!~|8$iq$N&HU diff --git a/scenes/main.tscn b/scenes/main.tscn new file mode 100644 index 00000000..725b2302 --- /dev/null +++ b/scenes/main.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=1] + +[ext_resource path="res://scripts/main.gd" type="Script" id=1] + +[node name="main" type="Node2D"] + +script/script = ExtResource( 1 ) +__meta__ = { "__editor_plugin_screen__":"Script" } + + diff --git a/test/gut/gut_main.scn b/test/gut/gut_main.scn index 19ab696eff4ee3f2cb0d3cd890e9caa3f38b79e7..b710bd683a71f204062bca4962f455b20086629e 100644 GIT binary patch delta 361 zcmWlVF)ssQ9EX3`qj$8bi3q)j{25FvrI`3vD?(_bT^b?po$HGW-jnt;=|Xk3G~L9| z#cC3(^9?Na4n6@Nfckxa=Xvt`HlGGE#ZoSZ|0RJ19TEks4-ch@ZJJSnw+{o$n1l@UkJqr3@S) z>~+K_14RplxN?HC8m1}1-~*Us8g*H%dAD3T%rJTJ~N~v-pKA zZba)&_11G#&^+M+CTSIV-w*x_=aHi1s1UN^1%6drU0k1fO3WNaq*UEkUZNhC9gW`m zsYDrm#BUdru)ztwaQtH?T5ZPGEbpkbmB=TR^c?%>DoS2Lz&FdjJ3c delta 939 zcmWlYUuYav6vofYoy}(Rr>;%XWS4Avcg>axO^I#VNU@tUJIh7|WoeC~wa%T)-rY>y zox9G=Zj)HpEd^VJKGdL?7G-Ox_)x?sv{oM+5)hR7;A4vqqm+s-K3E?l_-{OK2fp)t zzXRu7Q-1HAIeJXf;QxvPh#0_23V;OAkwEVBNFY%H1C$Jw4D(f9K4x;8gWpTz7Y`ng z&R?{0Z48h=l8&Pe5gLUaN^n(nAwy&M2__=XiZb6{2>LFuTRnQ6dxoyFS#?*m#U0lY zHsBG|@dfCo&%{h&+qx;5w#SkPeiCfT0y*g)#8+Z1!?6t8b73c)QZK_;m_))P!1kBe zk8_Zq@$I_K%a$h`y-{mcEn9azBRxSc2V@WKC8}-J*|2|-eG#!-YoW#&52yFw3A%-| zxQW{_8gp%h;a%Pp)s^Xdr!lB^D@a>O8a$oS8?4 zQ+O^~=9QXNUG#8T(wEtB`ScxXq%lKQDuxr10&Hm*$J25}v{*E3r}H?3-JX`kPc?+| z;WTE|uk+txIzKO!txQt3P0q$cT?cV2{}(Lb>)nygJ{*DNpmzidP@{#3kv2H&?#7c4 zr-ufbF4wu;vK(R8dFHqLjc~Ct{(`&c2a!cl6}ItnM8)fJL%7C{fI#q~A1b=R-+u6& zul}gLyP1;odbVl4wec0E9yzNR&6=m1=NE4IDHzVAiBVs$GCy=u*>$-l95zZWt+f+5 zpU5Gk`I+|Sy~uO^Q`!TTkcDGqKMEAC+473bul`EDzkT}%-joI*kk*LnR2SI(Fne4( zN^h`r?PEz_GK=!z;%n?&aq2#dNlr7n8sVO2+0}1GwfC`z@AR2X*AsQ!aH=jF!cAqe zMkh*c^&iY?e`4V$cp`KhyFbuYOowxOcN=NpkKIpWAKoiI2w#HIT(JcIc7bkVfZOmr qHADzVzpu`fI%;_FkFs98xq4078$BV Date: Sat, 14 Jan 2017 16:49:25 -0500 Subject: [PATCH 02/17] changed default removed .scn files --- scenes/main.scn | Bin 547 -> 0 bytes test/gut/gut_main.scn | Bin 549 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 scenes/main.scn delete mode 100644 test/gut/gut_main.scn diff --git a/scenes/main.scn b/scenes/main.scn deleted file mode 100644 index b287810158e02577c2ea68a28bf8418caaa271af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 547 zcmWlXKZw&{7{=c;ZIb?rRjGQV*S>ck2+CEf!dVC3*vffe%h5UrBFWd}^BQcw^qRDr zQvV$YqJyhLX9X8sh1?(_2rhzy;`J6c5l1JD&-6?W&yVM6cj|TcuN=Tx86X`4kN~C< z#83fgCPN0*%m%Y>ai?Q*!C{+<^D2Oh=RrqVA93Fsk8EBMY``Ij`&F|$7EYf#R!Q;g zkvj}3Q^k4=DlS9E%1dwvQ+PqDRc2+)uMC(gRyG~$7^HA9-uGX?tT4SOtQxU^VAbf!m|j za5Vy#qoD8M30T0~KGWom8+apg*dK4Y!d$XqoD1Bc=3cBzI@9r8R2cCb&EW40!W*R1 z7O{v;PKO44o*GeD9uA^L57VsM=cX(CfC(F&oulCuOEW&Eg5G%070m5J8S}7>vhrx7 zwU$j4s2I<#Uv9MVK!TzPk83oQ*H#yDm?<~c8^+b%-JhR~EMP7?NxOf(+}BFk4==2* vr(fTh#Dnmq@@Bp$rGBX^TR)`Q((k7=yr#qYrB>tBMe80wyVI_>qkH@VmAaHB diff --git a/test/gut/gut_main.scn b/test/gut/gut_main.scn deleted file mode 100644 index b710bd683a71f204062bca4962f455b20086629e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 549 zcmWlX&x;aq7{=dmbjIIVA+=`it8^>ZvNjew>}wjE(aNG7B#Q5hGv9PbzhllQ>}7E` z2!fzPx9H%xU@t9Qn>_|WU7|yW45C{^$4)gpf53<5!}GM-wHo|S3ZN(hBmw{uz)XSw zDj>~eh@%?c(vADvY#Ur~*rDvA3?SnbNTQq^bH|>H4PFxZkV6EIs;oN^=75`8PH~K} zHF8TcMSB7&7ND)AB{+pqT#r;rC6_yHsW;JNl?`=Etn^H+2vIBq2ezRP@J!$We8U96 zLVfRjhYV(E4??Jdf-*e|I8eX{?bCLsX`8%UUqqkNWtFiZcXh_Jb%^0A2rQ~>q`Q3w za+oBb+YrXEI^|=>vIS75dV@|-IbzsCFvFe*SIZE18EtbRW$1u1w5?3_v84-lc8{8H z64!il*#~{{&cPCqu&A9*vDHvj+t From 213e33fccf8f5947ef8e8af743b52620d1869127 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sat, 14 Jan 2017 16:50:28 -0500 Subject: [PATCH 03/17] forgot to add this --- engine.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine.cfg b/engine.cfg index d36be2f6..b0278a6d 100644 --- a/engine.cfg +++ b/engine.cfg @@ -1,7 +1,7 @@ [application] name="GUT" -main_scene="res://scenes/main.scn" +main_scene="res://scenes/main.tscn" icon="icon.png" [autoload] From 71323c173ca2896a60d5cf519d1bba72a4673177 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sat, 14 Jan 2017 17:25:19 -0500 Subject: [PATCH 04/17] now warns on float/int comparison --- test/gut/gut.gd | 15 ++++++++++++--- test/unit/test_gut.gd | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/test/gut/gut.gd b/test/gut/gut.gd index f8b6b089..57166ab6 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -903,10 +903,19 @@ func select_script(script_name): ################ func _pass_if_datatypes_match(got, expected, text): var passed = true + if(!_disable_strict_datatype_checks): - if(typeof(got) != typeof(expected) and got != null and expected != null): - _fail('Cannot compare ' + types[typeof(got)] + '[' + str(got) + '] to ' + types[typeof(expected)] + '[' + str(expected) + ']. ' + text) - passed = false + var got_type = typeof(got) + var expect_type = typeof(expected) + if(got_type != expect_type and got != null and expected != null): + # If we have a mismatch between float and int (types 2 and 3) then + # print out a warning but do not fail. + if([2, 3].has(got_type) and [2, 3].has(expect_type)): + p(str('Warn: Float/Int comparison. Got ', types[got_type], ' but expected ', types[expect_type]), 1) + else: + _fail('Cannot compare ' + types[got_type] + '[' + str(got) + '] to ' + types[expect_type] + '[' + str(expected) + ']. ' + text) + passed = false + return passed #------------------------------------------------------------------------------- diff --git a/test/unit/test_gut.gd b/test/unit/test_gut.gd index a2d91785..5509a4d2 100644 --- a/test/unit/test_gut.gd +++ b/test/unit/test_gut.gd @@ -295,9 +295,9 @@ func test_assert_false_with_false(): #------------------------------ # disable strict datatype comparisons #------------------------------ -func test_when_strict_enabled_you_cannot_compare_in_and_float(): +func test_when_strict_enabled_you_can_compare_int_and_float(): gr.test_gut.assert_eq(1.0, 1) - assert_fail() + assert_pass() func test_when_strict_disabled_can_compare_int_and_float(): gr.test_gut.disable_strict_datatype_checks(true) From 62bd214188e46610410643beee6dbc718c710e19 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sat, 14 Jan 2017 17:33:39 -0500 Subject: [PATCH 05/17] added msg --- test/unit/test_gut.gd | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/test_gut.gd b/test/unit/test_gut.gd index 5509a4d2..baadfc34 100644 --- a/test/unit/test_gut.gd +++ b/test/unit/test_gut.gd @@ -594,6 +594,7 @@ func test_asserts_on_test_object(): #------------------------------------------------------------------------------- func test_verify_results(): gut.p("/*THESE SHOULD ALL PASS, IF NOT THEN SOMETHING IS BROKEN*/") + gut.p("/*These counts will be off if another script was run before this one.*/") gut.assert_eq(1, counts.prerun_setup_count, "Prerun setup should have been called once") gut.assert_eq(gut.get_test_count(), counts.setup_count, "Setup should have been called once for each test") # teardown for this test hasn't been run yet. From 71a26ca7a0655681aa8ab6e2600b12123890c263 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sat, 14 Jan 2017 17:41:37 -0500 Subject: [PATCH 06/17] issue 4 fixed, buttons update when drop down changes --- test/gut/gut.gd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/gut/gut.gd b/test/gut/gut.gd index 57166ab6..a0538dc5 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -267,6 +267,7 @@ func setup_controls(): _ctrls.scripts_drop_down.set_pos(Vector2(10, _ctrls.log_level_slider.get_pos().y + 50)) _ctrls.scripts_drop_down.add_item("Run All") _set_anchor_bottom_left(_ctrls.scripts_drop_down) + _ctrls.scripts_drop_down.connect('item_selected', self, '_on_script_selected') add_child(_ctrls.previous_button) _ctrls.previous_button.set_size(Vector2(50, 25)) @@ -492,6 +493,10 @@ func _on_ignore_continue_checkbox_pressed(): if(!_ctrls.continue_button.is_disabled()): _on_continue_button_pressed() +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +func _on_script_selected(id): + _update_controls() ##################### # # Private From 2a89266b3f0c6479f533a58c17a39c6cb5d51ee2 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sat, 14 Jan 2017 18:09:14 -0500 Subject: [PATCH 07/17] appears to be working --- test/gut/gut.gd | 4 +++- test/unit/test_gut_yielding.gd | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/test/gut/gut.gd b/test/gut/gut.gd index a0538dc5..0cf91341 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -558,6 +558,7 @@ func _fail(text): p('FAILED: ' + text, LOG_LEVEL_FAIL_ONLY) if(_current_test != null): p(' at line ' + str(_current_test.line_number), LOG_LEVEL_FAIL_ONLY) + end_yielded_test() #------------------------------------------------------------------------------- #Pass an assertion. @@ -567,6 +568,7 @@ func _pass(text): _summary.passed += 1 if(_log_level >= LOG_LEVEL_ALL_ASSERTS): p("PASSED: " + text, LOG_LEVEL_ALL_ASSERTS) + end_yielded_test() #------------------------------------------------------------------------------- #Convert the _summary struct into text for display @@ -1070,7 +1072,7 @@ func pending(text=""): p("Pending") else: p("Pending: " + text) - + end_yielded_test() ################ # # MISC diff --git a/test/unit/test_gut_yielding.gd b/test/unit/test_gut_yielding.gd index fd3cc8bc..22fbf7c7 100644 --- a/test/unit/test_gut_yielding.gd +++ b/test/unit/test_gut_yielding.gd @@ -1,8 +1,6 @@ #------------------------------------------------------------------------------- -#All of these tests require some amount of user interaction or verifying of the -#output so they were moved into a different script for testing. Also the yield -#functionality does not work in 1.0 so this allows us to test that 1.0 functionality -#continues to work even with these changes. +# All of these tests require some amount of user interaction or verifying of the +# output so they were moved into a different script for testing. #------------------------------------------------------------------------------- extends "res://test/gut/gut.gd".Test @@ -76,3 +74,15 @@ func test_new_yield(): yield(yield_for(1, 'first yield'), 'timeout') yield(yield_for(1, 'waiting around for stuff'), YIELD) end_test() + +func test_passing_assert_ends_yield(): + yield(yield_for(0.5), YIELD) + assert_true(true) + +func test_failing_assert_ends_yield(): + yield(yield_for(0.5), YIELD) + assert_false(true, 'This should fail.') + +func test_pending_ends_yield(): + yield(yield_for(0.5), YIELD) + pending('this is pending but should end test') From 9a31117996995510adb26204c4d64ed550175a34 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sat, 14 Jan 2017 19:40:56 -0500 Subject: [PATCH 08/17] fix #16 --- test/gut/gut.gd | 4 ++++ test/gut/gut_main.gd | 2 +- test/unit/test_gut.gd | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/test/gut/gut.gd b/test/gut/gut.gd index 0cf91341..ff5a9a22 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -1172,6 +1172,10 @@ func pause_before_teardown(): #------------------------------------------------------------------------------- func set_ignore_pause_before_teardown(should_ignore): _ignore_pause_before_teardown = should_ignore + _ctrls.ignore_continue_checkbox.set_pressed(should_ignore) + +func get_ignore_pause_before_teardown(): + return _ignore_pause_before_teardown #------------------------------------------------------------------------------- #Set to true so that painting of the screen will occur between tests. Allows you diff --git a/test/gut/gut_main.gd b/test/gut/gut_main.gd index f7712e64..915549ea 100644 --- a/test/gut/gut_main.gd +++ b/test/gut/gut_main.gd @@ -47,4 +47,4 @@ func _run_tests(): tester.set_should_print_to_console(true) tester.set_yield_between_tests(true) tester.add_directory('res://test/unit') - tester.test_scripts() + #tester.test_scripts() diff --git a/test/unit/test_gut.gd b/test/unit/test_gut.gd index baadfc34..5428122f 100644 --- a/test/unit/test_gut.gd +++ b/test/unit/test_gut.gd @@ -124,7 +124,21 @@ func postrun_teardown(): gut.assert_true(true, 'POSTTEARDOWN RAN') gut.directory_delete_files('user://') - +#------------------------------ +# Settings +#------------------------------ +func test_get_set_ingore_pauses(): + assert_get_set_methods(gr.test_gut, 'ignore_pause_before_teardown', false, true) + +func test_when_ignore_pauses_set_it_checks_checkbox(): + gr.test_gut.set_ignore_pause_before_teardown(true) + assert_true(gr.test_gut._ctrls.ignore_continue_checkbox.is_pressed()) + +func test_when_ignore_pauses_unset_it_unchecks_checkbox(): + gr.test_gut.set_ignore_pause_before_teardown(true) + gr.test_gut.set_ignore_pause_before_teardown(false) + assert_false(gr.test_gut._ctrls.ignore_continue_checkbox.is_pressed()) + #------------------------------ #Number tests #------------------------------ From 29f04e07808d82de4986423e925eb75725e91783 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sun, 15 Jan 2017 17:25:37 -0500 Subject: [PATCH 09/17] crude counter --- test/gut/gut.gd | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/test/gut/gut.gd b/test/gut/gut.gd index ff5a9a22..a704c9d0 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -105,7 +105,8 @@ var _ctrls = { script_progress = ProgressBar.new(), test_progress = ProgressBar.new(), runtime_label = Label.new(), - ignore_continue_checkbox = CheckBox.new() + ignore_continue_checkbox = CheckBox.new(), + pass_count = Label.new() } var _mouse_down = false @@ -196,8 +197,15 @@ func setup_controls(): add_child(_ctrls.runtime_label) _ctrls.runtime_label.set_text('0.0') _ctrls.runtime_label.set_size(Vector2(50, 30)) - _ctrls.runtime_label.set_pos(Vector2(_ctrls.clear_button.get_pos().x - 60, _ctrls.clear_button.get_pos().y + 10)) + _ctrls.runtime_label.set_pos(Vector2(_ctrls.clear_button.get_pos().x - 90, _ctrls.clear_button.get_pos().y + 75)) _set_anchor_bottom_right(_ctrls.runtime_label) + + add_child(_ctrls.pass_count) + _ctrls.pass_count.set_text('p/f: 0/0') + _ctrls.pass_count.set_size(Vector2(50, 30)) + _ctrls.pass_count.set_pos(Vector2(_ctrls.clear_button.get_pos().x - 90, _ctrls.clear_button.get_pos().y + 50)) + _set_anchor_bottom_right(_ctrls.pass_count) + add_child(_ctrls.continue_button) _ctrls.continue_button.set_text("Continue") @@ -519,7 +527,7 @@ func _update_controls(): # enabled during run _ctrls.stop_button.set_disabled(!_is_running) - + _ctrls.pass_count.set_text(str('p-f: ', _summary.passed, '-', _summary.failed)) @@ -558,7 +566,9 @@ func _fail(text): p('FAILED: ' + text, LOG_LEVEL_FAIL_ONLY) if(_current_test != null): p(' at line ' + str(_current_test.line_number), LOG_LEVEL_FAIL_ONLY) + _update_controls() end_yielded_test() + #------------------------------------------------------------------------------- #Pass an assertion. @@ -568,7 +578,9 @@ func _pass(text): _summary.passed += 1 if(_log_level >= LOG_LEVEL_ALL_ASSERTS): p("PASSED: " + text, LOG_LEVEL_ALL_ASSERTS) + _update_controls() end_yielded_test() + #------------------------------------------------------------------------------- #Convert the _summary struct into text for display From 9705c27a5aac5006b277fcc4bd9d96682f432710 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sun, 15 Jan 2017 22:42:02 -0500 Subject: [PATCH 10/17] a little better --- .DS_Store | Bin 0 -> 6148 bytes test/.DS_Store | Bin 0 -> 6148 bytes test/gut/gut.gd | 14 ++++++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .DS_Store create mode 100644 test/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8eb33cbb2955e0836a93c1ac294a56575eea3a9d GIT binary patch literal 6148 zcmeHK!A{#i5Zz5ev6V=5B@U^?!4d~9IRpXC)e3M!YK0>>w2<1e)tFi~vNy>gie!F( z4*;$d{sTUu$NmI&W_CA-C~&I~K{L|qo1LB6&AyFxyo@p4?gwj(S&T6Q6tQGN^Nip) z>Wq}M2a)3({xCoBUA$Z{s0o}YgbN4aP=|MF6~vhZQiFwJVs ztbME!t(=yk$mCk_W;@-^G_M5sbLX&OU- zOzU|5eiRP7*3wp*2ro*)OwO(5_;C;=K{{-w{Upd`yq?@JR-E7eB$=jRcCGqow9(pZ z*cVO76A91{bhypgg zB@k_mj>bYEjDT>J3aC=KeqwNy4t`t5IT{OvDxGn;GR&h_=K6)gbQQowJc0qAHf6oLnYJ_IBU)DQ!&%D@9bm0>&p literal 0 HcmV?d00001 diff --git a/test/.DS_Store b/test/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..feb091847fd44a7d1f0f44f7b2f2cc24f9428a4f GIT binary patch literal 6148 zcmeHK%}T>S5Z<*_Q$)-`u*Y1y_0VE#PeO?G;7y3=L8VPdX#+7SO=8d($!q8v`2@a> zGrJpUu?J5gb_RC8nVp&4%m>*Y#u&F!ufv$m7}KC3a#U6b4zF}=s9;2nbHp<@h+MGV z-I?wpfg&*-lsqJWNX2}DDosj!p? z9uO{50c9#zPYf>8Vcbx0rovL9OlMrI4D+a!tH%o$tHZb{ aI>ea@ONlrOj*E0ax(EnDs3Qh`fq_qX?@#Oi literal 0 HcmV?d00001 diff --git a/test/gut/gut.gd b/test/gut/gut.gd index a704c9d0..ac6f7371 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -120,6 +120,12 @@ var min_size = Vector2(650, 400) const SIGNAL_TESTS_FINISHED = 'tests_finished' const SIGNAL_STOP_YIELD_BEFORE_TEARDOWN = 'stop_yeild_before_teardown' + +func _set_anchor_top_right(obj): + obj.set_anchor(MARGIN_RIGHT, ANCHOR_BEGIN) + obj.set_anchor(MARGIN_LEFT, ANCHOR_END) + obj.set_anchor(MARGIN_TOP, ANCHOR_BEGIN) + func _set_anchor_bottom_right(obj): obj.set_anchor(MARGIN_LEFT, ANCHOR_END) obj.set_anchor(MARGIN_RIGHT, ANCHOR_END) @@ -201,10 +207,10 @@ func setup_controls(): _set_anchor_bottom_right(_ctrls.runtime_label) add_child(_ctrls.pass_count) - _ctrls.pass_count.set_text('p/f: 0/0') + _ctrls.pass_count.set_text('0 - 0') _ctrls.pass_count.set_size(Vector2(50, 30)) - _ctrls.pass_count.set_pos(Vector2(_ctrls.clear_button.get_pos().x - 90, _ctrls.clear_button.get_pos().y + 50)) - _set_anchor_bottom_right(_ctrls.pass_count) + _ctrls.pass_count.set_pos(Vector2(550, 0)) + _set_anchor_top_right(_ctrls.pass_count) add_child(_ctrls.continue_button) @@ -527,7 +533,7 @@ func _update_controls(): # enabled during run _ctrls.stop_button.set_disabled(!_is_running) - _ctrls.pass_count.set_text(str('p-f: ', _summary.passed, '-', _summary.failed)) + _ctrls.pass_count.set_text(str( _summary.passed, ' - ', _summary.failed)) From 85fb241638d60f641e9aa82671eb7e4e8c53910d Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sun, 15 Jan 2017 22:50:33 -0500 Subject: [PATCH 11/17] fix #14 --- test/gut/gut.gd | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/gut/gut.gd b/test/gut/gut.gd index ac6f7371..7fe345a5 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -71,8 +71,6 @@ var _yield_between = { var types = {} - - var _set_yield_time_called = false # used when yielding to gut instead of some other # signal. Start with set_yield_time() From 7eb79f0cb12510d0012b53de1fa23c08d4504ad3 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Sun, 15 Jan 2017 23:22:09 -0500 Subject: [PATCH 12/17] fix #5 --- test/gut/gut.gd | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/test/gut/gut.gd b/test/gut/gut.gd index 7fe345a5..2ac394f1 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -104,7 +104,8 @@ var _ctrls = { test_progress = ProgressBar.new(), runtime_label = Label.new(), ignore_continue_checkbox = CheckBox.new(), - pass_count = Label.new() + pass_count = Label.new(), + run_rest = Button.new() } var _mouse_down = false @@ -284,7 +285,7 @@ func setup_controls(): add_child(_ctrls.previous_button) _ctrls.previous_button.set_size(Vector2(50, 25)) pos = _ctrls.scripts_drop_down.get_pos() + Vector2(_ctrls.scripts_drop_down.get_size().x, -30) - pos.x -= 240 + pos.x -= 300 _ctrls.previous_button.set_pos(pos) _ctrls.previous_button.set_text("<") _ctrls.previous_button.connect("pressed", self, '_on_previous_button_pressed') @@ -306,6 +307,14 @@ func setup_controls(): _ctrls.run_button.connect("pressed", self, "_on_run_button_pressed") _set_anchor_bottom_left(_ctrls.run_button) + add_child(_ctrls.run_rest) + _ctrls.run_rest.set_text("rr") + _ctrls.run_rest.set_size(Vector2(50, 25)) + pos.x += 60 + _ctrls.run_rest.set_pos(pos) + _ctrls.run_rest.connect('pressed', self, '_on_run_rest_pressed') + _set_anchor_bottom_left(_ctrls.run_rest) + add_child(_ctrls.next_button) _ctrls.next_button.set_size(Vector2(50, 25)) pos.x += 60 @@ -509,6 +518,12 @@ func _on_ignore_continue_checkbox_pressed(): #------------------------------------------------------------------------------- func _on_script_selected(id): _update_controls() + +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +func _on_run_rest_pressed(): + test_scripts(true) + ##################### # # Private @@ -844,7 +859,7 @@ func p(text, level=0, indent=0): #------------------------------------------------------------------------------- #Runs all the scripts that were added using add_script #------------------------------------------------------------------------------- -func test_scripts(): +func test_scripts(run_rest=false): clear_text() _test_scripts.clear() @@ -852,7 +867,11 @@ func test_scripts(): for idx in range(1, _ctrls.scripts_drop_down.get_item_count()): _test_scripts.append(_ctrls.scripts_drop_down.get_item_text(idx)) else: - _test_scripts.append(_ctrls.scripts_drop_down.get_item_text(_ctrls.scripts_drop_down.get_selected())) + if(run_rest): + for idx in range(_ctrls.scripts_drop_down.get_selected(), _ctrls.scripts_drop_down.get_item_count()): + _test_scripts.append(_ctrls.scripts_drop_down.get_item_text(idx)) + else: + _test_scripts.append(_ctrls.scripts_drop_down.get_item_text(_ctrls.scripts_drop_down.get_selected())) _test_the_scripts() From bd32e1d90e197a000a1973e5f336eac3739e4d8f Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Mon, 16 Jan 2017 01:24:25 -0500 Subject: [PATCH 13/17] better layout, cmdline works with new run1 optons --- .DS_Store | Bin 6148 -> 6148 bytes test/gut/gut.gd | 51 +++++++++++++++++++++--------------------- test/gut/gut_cmdln.gd | 5 ++++- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/.DS_Store b/.DS_Store index 8eb33cbb2955e0836a93c1ac294a56575eea3a9d..55193828fe25264c4943fb4878ea3feb1ece7f1e 100644 GIT binary patch delta 151 zcmZoMXfc?O%y@FMA@g#^$p#`UllhrM3{NH%zR;SSyf$A hTQ`#d3>X<9Gy^}BhEcONOESM>nb@GSnVsV=KLBk1CD#A| delta 192 zcmZoMXfc?O%=mS)AoFs@$p#`UllhrMg1#mdjdITfX8jSdM{_5kfNvLTMOv QWb<35cPyLPIsWnk0H*Rak^lez diff --git a/test/gut/gut.gd b/test/gut/gut.gd index 2ac394f1..d0b82df4 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -198,20 +198,14 @@ func setup_controls(): _ctrls.clear_button.set_pos(_ctrls.copy_button.get_pos() - Vector2(button_size.x, 0) - button_spacing) _ctrls.clear_button.connect("pressed", self, "clear_text") _set_anchor_bottom_right(_ctrls.clear_button) - - add_child(_ctrls.runtime_label) - _ctrls.runtime_label.set_text('0.0') - _ctrls.runtime_label.set_size(Vector2(50, 30)) - _ctrls.runtime_label.set_pos(Vector2(_ctrls.clear_button.get_pos().x - 90, _ctrls.clear_button.get_pos().y + 75)) - _set_anchor_bottom_right(_ctrls.runtime_label) add_child(_ctrls.pass_count) _ctrls.pass_count.set_text('0 - 0') - _ctrls.pass_count.set_size(Vector2(50, 30)) + _ctrls.pass_count.set_size(Vector2(100, 30)) _ctrls.pass_count.set_pos(Vector2(550, 0)) + _ctrls.pass_count.set_align(HALIGN_RIGHT) _set_anchor_top_right(_ctrls.pass_count) - add_child(_ctrls.continue_button) _ctrls.continue_button.set_text("Continue") _ctrls.continue_button.set_size(Vector2(100, 25)) @@ -278,10 +272,18 @@ func setup_controls(): add_child(_ctrls.scripts_drop_down) _ctrls.scripts_drop_down.set_size(Vector2(375, 25)) _ctrls.scripts_drop_down.set_pos(Vector2(10, _ctrls.log_level_slider.get_pos().y + 50)) - _ctrls.scripts_drop_down.add_item("Run All") _set_anchor_bottom_left(_ctrls.scripts_drop_down) _ctrls.scripts_drop_down.connect('item_selected', self, '_on_script_selected') + add_child(_ctrls.run_button) + _ctrls.run_button.set_text('<- run') + _ctrls.run_button.set_size(Vector2(50, 25)) + #pos.x += 60 + #_ctrls.run_button.set_pos(pos) + _ctrls.run_button.set_pos(_ctrls.scripts_drop_down.get_pos() + Vector2(_ctrls.scripts_drop_down.get_size().x + 5, 0)) + _ctrls.run_button.connect("pressed", self, "_on_run_button_pressed") + _set_anchor_bottom_left(_ctrls.run_button) + add_child(_ctrls.previous_button) _ctrls.previous_button.set_size(Vector2(50, 25)) pos = _ctrls.scripts_drop_down.get_pos() + Vector2(_ctrls.scripts_drop_down.get_size().x, -30) @@ -299,16 +301,8 @@ func setup_controls(): _ctrls.stop_button.connect("pressed", self, '_on_stop_button_pressed') _set_anchor_bottom_left(_ctrls.stop_button) - add_child(_ctrls.run_button) - _ctrls.run_button.set_text("run") - _ctrls.run_button.set_size(Vector2(50, 25)) - pos.x += 60 - _ctrls.run_button.set_pos(pos) - _ctrls.run_button.connect("pressed", self, "_on_run_button_pressed") - _set_anchor_bottom_left(_ctrls.run_button) - add_child(_ctrls.run_rest) - _ctrls.run_rest.set_text("rr") + _ctrls.run_rest.set_text('run') _ctrls.run_rest.set_size(Vector2(50, 25)) pos.x += 60 _ctrls.run_rest.set_pos(pos) @@ -323,6 +317,12 @@ func setup_controls(): _ctrls.next_button.connect("pressed", self, '_on_next_button_pressed') _set_anchor_bottom_left(_ctrls.next_button) + add_child(_ctrls.runtime_label) + _ctrls.runtime_label.set_text('0.0') + _ctrls.runtime_label.set_size(Vector2(50, 30)) + _ctrls.runtime_label.set_pos(Vector2(_ctrls.clear_button.get_pos().x - 90, _ctrls.next_button.get_pos().y)) + _set_anchor_bottom_right(_ctrls.runtime_label) + #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- func _init(): @@ -542,6 +542,7 @@ func _update_controls(): # disabled during run _ctrls.run_button.set_disabled(_is_running) + _ctrls.run_rest.set_disabled(_is_running) _ctrls.scripts_drop_down.set_disabled(_is_running) # enabled during run @@ -863,15 +864,11 @@ func test_scripts(run_rest=false): clear_text() _test_scripts.clear() - if(_ctrls.scripts_drop_down.get_selected() == 0): - for idx in range(1, _ctrls.scripts_drop_down.get_item_count()): + if(run_rest): + for idx in range(_ctrls.scripts_drop_down.get_selected(), _ctrls.scripts_drop_down.get_item_count()): _test_scripts.append(_ctrls.scripts_drop_down.get_item_text(idx)) else: - if(run_rest): - for idx in range(_ctrls.scripts_drop_down.get_selected(), _ctrls.scripts_drop_down.get_item_count()): - _test_scripts.append(_ctrls.scripts_drop_down.get_item_text(idx)) - else: - _test_scripts.append(_ctrls.scripts_drop_down.get_item_text(_ctrls.scripts_drop_down.get_selected())) + _test_scripts.append(_ctrls.scripts_drop_down.get_item_text(_ctrls.scripts_drop_down.get_selected())) _test_the_scripts() @@ -891,6 +888,10 @@ func test_script(script): func add_script(script, select_this_one=false): _test_scripts.append(script) _ctrls.scripts_drop_down.add_item(script) + # Move the run_button in case the size of the path of the script caused the + # drop down to resize. + _ctrls.run_button.set_pos(_ctrls.scripts_drop_down.get_pos() + \ + Vector2(_ctrls.scripts_drop_down.get_size().x + 5, 0)) if(select_this_one): _ctrls.scripts_drop_down.select(_ctrls.scripts_drop_down.get_item_count() -1) diff --git a/test/gut/gut_cmdln.gd b/test/gut/gut_cmdln.gd index 431a02e0..01ef30fd 100644 --- a/test/gut/gut_cmdln.gd +++ b/test/gut/gut_cmdln.gd @@ -243,6 +243,8 @@ var options = { # set to false if you specify a script to run with the -gselect # option and it cannot find the script. var _auto_run = true +# flag to indicate if only a single script should be run. +var _run_single = false func setup_options(): var opts = Options.new() @@ -304,6 +306,7 @@ func apply_options(): if(options.selected != ''): _auto_run = _tester.select_script(options.selected) + _run_single = true if(!_auto_run): _tester.p("Could not find a script that matched: " + options.selected) @@ -334,7 +337,7 @@ func _init(): apply_options() if(_auto_run): - _tester.test_scripts() + _tester.test_scripts(!_run_single) # exit if option is set. func _on_tests_finished(): From 033488e561494710f03d5eef0f234a1db32a7efb Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Mon, 16 Jan 2017 01:31:46 -0500 Subject: [PATCH 14/17] readme --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f02450b3..55908abd 100644 --- a/README.md +++ b/README.md @@ -123,9 +123,9 @@ This guy warrants his own section. I found that making tests for most getters a * `gut.p(text, level=0, indent=0)` print info to the GUI and console (if enabled.) * `gut.pause_before_teardown()` This method will cause Gut to pause before it moves on to the next test. This is useful for debugging, for instance if you want to investigate the screen or anything else after a test has finished executing. See also `set_ignore_pause_before_teardown` -* `yield_for(time_in_seconds)` Basically this simplifies the code needed to pause the test execution for a number of seconds. This is useful if your test requires things to play out in real time before making an assertion. There are more details in the Yielding section. It is designed to be used with the `yield` built in. The following example will pause your test execution (and only the test execution) for 5 seconds before continuing. You must call `end_test()` in any test that has a yield in it or execution will not continue. +* `yield_for(time_in_seconds)` Basically this simplifies the code needed to pause the test execution for a number of seconds. This is useful if your test requires things to play out in real time before making an assertion. There are more details in the Yielding section. It is designed to be used with the `yield` built in. The following example will pause your test execution (and only the test execution) for 5 seconds before continuing. You must call an assert or `pending` or `end_test()` after a yield or the test will never stop running. * `yield(yield_for(5), YIELD)` -* `end_test()` This must be called in any test that has a `yield` in it (regardless of what is yielded to) so that Gut knows when the test has completed. +* `end_test()` This can be called instead of an assert or `pending` to end a test that has yielded. ### Methods for Configuring the Execution of Tests These methods would be used inside the Scene's script (`templates/gut_main.gd`) to load and execute scripts as well as inspect the results of a run and change how Gut behaves. These methods must all be called on the Gut object that was instantiated. In the case of the provided template, this would be `tester`. @@ -250,7 +250,7 @@ func test_does_something_each_loop(): ``` ## Yielding during a test -I'm not going to try and explain yielding here. It's can be a bit confusing and [Godot does a pretty good job of it already](http://docs.godotengine.org/en/latest/reference/gdscript.html#coroutines). Gut has support for yielding though, so you can yield at anytime in your test. The one caveat is that you must tell Gut when your test has completed so it can continue running tests. You do this by calling `end_test()`. +I'm not going to try and explain yielding here. It's can be a bit confusing and [Godot does a pretty good job of it already](http://docs.godotengine.org/en/latest/reference/gdscript.html#coroutines). Gut has support for yielding though, so you can yield at anytime in your test. The one caveat is that you must use one of the various asserts or `pending()` after the yield. Otherwise Gut won't know that the yield has finished. You can optionally use `end_test()` if an assert or `pending` doesn't make sense for some reason. When might you want to yield? Yielding is very handy when you want to wait for a signal to occur instead of running for a finite amount of time. For example, you could have your test yield until your character gets hit by something (`yield(my_char, 'hit')`). An added bonus of this approach is that you can watch everything happen. In your test you create your character, the object to hit it, and then watch the interaction play out. @@ -261,7 +261,6 @@ func test_yield_to_custom_signal(): add_child(my_object) yield(my_object, 'custom_signal') assert_true(some_condition, 'After signal fired, this should be true') - end_test() ``` Another use case I have come across is when creating integration tests and you want to verify that a complex interaction ends with an expected result. In this case you might have an idea of how long the interaction will take to play out but you don't have a signal that you can attach to. Instead you want to pause your test execution until that time has elapsed. For this, Gut has the `yield_for` method. This method has a little magic in it, but all you really need to know is that the following line will pause your test execution for 5 seconds while the rest of your code executes as expected: `yield(yield_for(5), YIELD)`. @@ -274,12 +273,11 @@ func test_wait_for_a_bit(): #wait 5 seconds yield(yield_for(5), YIELD) gut.assert_eq(my_object.some_property, 'some value', 'After waiting 5 seconds, this property should be set') - end_test() ``` Sometimes it's also helpful to just watch things play out. Yield is great for that, you just create a couple objects, set them to interact and then yield. You can leave the yields in or take them out if your test passes without them. You can also use the `pause_before_teardown` method that will pause test execution before it runs `teardown` and moves onto the next test. This keeps the game loop running after the test has finished and you can see what everything looks like. ### How Yielding and Gut Works -For those that are interested, Gut is able to detect when a test has called yield because the method returns a special class back. Gut itself will then `yield` to an internal timer and check to see if `end_test` has been called every second, if not it waits again. It continues to do this until `end_test` has been called. +For those that are interested, Gut is able to detect when a test has called yield because the method returns a special class back. Gut itself will then `yield` to an internal timer and check to see if an assertion or `pending()` or `end_test()` has been called every second, if not it waits again. If you only yielded using `yield_for` then Gut would always know when to resume the test and could handle it itself. You can yield to anything though and Gut cannot tell the difference. Also, when you yield to something else Gut has no way of knowing when the method has continued so you have to tell it when you are done so it will stop waiting. One side effect of this is that if you `yield` multiple times in the same test, Gut can't tell. It continues to wait from the first yield and you won't see any additional "yield detected" outputs in the GUI or console. From bb96148a9b9260280b2b19e87c96f0d409e5eab0 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Tue, 17 Jan 2017 12:23:11 -0500 Subject: [PATCH 15/17] more layout stuff --- test/gut/gut.gd | 38 +++++++++++-------- test/gut/gut_main.gd | 1 + .../test_sample_all_passed_integration.gd | 2 +- ..._has_a_really_long_name_to_test_display.gd | 4 ++ 4 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 test/integration/test_this_scirpt_has_a_really_long_name_to_test_display.gd diff --git a/test/gut/gut.gd b/test/gut/gut.gd index d0b82df4..f0755851 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -269,24 +269,9 @@ func setup_controls(): _ctrls.test_progress.set_unit_value(1) _set_anchor_bottom_left(_ctrls.test_progress) - add_child(_ctrls.scripts_drop_down) - _ctrls.scripts_drop_down.set_size(Vector2(375, 25)) - _ctrls.scripts_drop_down.set_pos(Vector2(10, _ctrls.log_level_slider.get_pos().y + 50)) - _set_anchor_bottom_left(_ctrls.scripts_drop_down) - _ctrls.scripts_drop_down.connect('item_selected', self, '_on_script_selected') - - add_child(_ctrls.run_button) - _ctrls.run_button.set_text('<- run') - _ctrls.run_button.set_size(Vector2(50, 25)) - #pos.x += 60 - #_ctrls.run_button.set_pos(pos) - _ctrls.run_button.set_pos(_ctrls.scripts_drop_down.get_pos() + Vector2(_ctrls.scripts_drop_down.get_size().x + 5, 0)) - _ctrls.run_button.connect("pressed", self, "_on_run_button_pressed") - _set_anchor_bottom_left(_ctrls.run_button) - add_child(_ctrls.previous_button) _ctrls.previous_button.set_size(Vector2(50, 25)) - pos = _ctrls.scripts_drop_down.get_pos() + Vector2(_ctrls.scripts_drop_down.get_size().x, -30) + pos = _ctrls.test_progress.get_pos() + Vector2(250, 25) pos.x -= 300 _ctrls.previous_button.set_pos(pos) _ctrls.previous_button.set_text("<") @@ -323,6 +308,24 @@ func setup_controls(): _ctrls.runtime_label.set_pos(Vector2(_ctrls.clear_button.get_pos().x - 90, _ctrls.next_button.get_pos().y)) _set_anchor_bottom_right(_ctrls.runtime_label) + # the drop down has to be one of the last added so that when then list of + # scripts is displayed, other controls do not get in the way of selecting + # an item in the list. + add_child(_ctrls.scripts_drop_down) + _ctrls.scripts_drop_down.set_size(Vector2(375, 25)) + _ctrls.scripts_drop_down.set_pos(Vector2(10, _ctrls.log_level_slider.get_pos().y + 50)) + _set_anchor_bottom_left(_ctrls.scripts_drop_down) + _ctrls.scripts_drop_down.connect('item_selected', self, '_on_script_selected') + _ctrls.scripts_drop_down.set_clip_text(true) + + add_child(_ctrls.run_button) + _ctrls.run_button.set_text('<- run') + _ctrls.run_button.set_size(Vector2(50, 25)) + _ctrls.run_button.set_pos(_ctrls.scripts_drop_down.get_pos() + Vector2(_ctrls.scripts_drop_down.get_size().x + 5, 0)) + _ctrls.run_button.connect("pressed", self, "_on_run_button_pressed") + _set_anchor_bottom_left(_ctrls.run_button) + + #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- func _init(): @@ -366,6 +369,7 @@ func _ready(): set_process(true) set_pause_mode(PAUSE_MODE_PROCESS) + #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- func _process(delta): @@ -547,6 +551,7 @@ func _update_controls(): # enabled during run _ctrls.stop_button.set_disabled(!_is_running) + _ctrls.pass_count.set_visible(_is_running) _ctrls.pass_count.set_text(str( _summary.passed, ' - ', _summary.failed)) @@ -892,6 +897,7 @@ func add_script(script, select_this_one=false): # drop down to resize. _ctrls.run_button.set_pos(_ctrls.scripts_drop_down.get_pos() + \ Vector2(_ctrls.scripts_drop_down.get_size().x + 5, 0)) + if(select_this_one): _ctrls.scripts_drop_down.select(_ctrls.scripts_drop_down.get_item_count() -1) diff --git a/test/gut/gut_main.gd b/test/gut/gut_main.gd index 915549ea..493dc0f9 100644 --- a/test/gut/gut_main.gd +++ b/test/gut/gut_main.gd @@ -47,4 +47,5 @@ func _run_tests(): tester.set_should_print_to_console(true) tester.set_yield_between_tests(true) tester.add_directory('res://test/unit') + tester.add_directory('res://test/integration') #tester.test_scripts() diff --git a/test/integration/test_sample_all_passed_integration.gd b/test/integration/test_sample_all_passed_integration.gd index 1bcae4f9..38ba8188 100644 --- a/test/integration/test_sample_all_passed_integration.gd +++ b/test/integration/test_sample_all_passed_integration.gd @@ -1,6 +1,6 @@ #A sample script for illustrating multiple scripts and what it looks like #when all tests pass. -extends "res://scripts/gut.gd".Test +extends "res://test/gut/gut.gd".Test func test_works(): gut.assert_true(true, 'This is true') diff --git a/test/integration/test_this_scirpt_has_a_really_long_name_to_test_display.gd b/test/integration/test_this_scirpt_has_a_really_long_name_to_test_display.gd new file mode 100644 index 00000000..aafa4f99 --- /dev/null +++ b/test/integration/test_this_scirpt_has_a_really_long_name_to_test_display.gd @@ -0,0 +1,4 @@ +extends "res://test/gut/gut.gd".Test + +func test_nothing(): + pending('do not need a test, but felt weird to not have one.') \ No newline at end of file From 93b10587a4c0acf95c21c3bdec14c4c05de41e73 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Tue, 17 Jan 2017 12:36:43 -0500 Subject: [PATCH 16/17] only show pass/fail counter while running --- test/gut/gut.gd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/gut/gut.gd b/test/gut/gut.gd index f0755851..b18ebde4 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -369,6 +369,7 @@ func _ready(): set_process(true) set_pause_mode(PAUSE_MODE_PROCESS) + _update_controls() #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- @@ -540,9 +541,11 @@ func _update_controls(): if(_is_running): _ctrls.previous_button.set_disabled(true) _ctrls.next_button.set_disabled(true) + _ctrls.pass_count.show() else: _ctrls.previous_button.set_disabled(_ctrls.scripts_drop_down.get_selected() == 0) _ctrls.next_button.set_disabled(_ctrls.scripts_drop_down.get_selected() == _ctrls.scripts_drop_down.get_item_count() -1) + _ctrls.pass_count.hide() # disabled during run _ctrls.run_button.set_disabled(_is_running) @@ -551,7 +554,6 @@ func _update_controls(): # enabled during run _ctrls.stop_button.set_disabled(!_is_running) - _ctrls.pass_count.set_visible(_is_running) _ctrls.pass_count.set_text(str( _summary.passed, ' - ', _summary.failed)) From b54f22f5c11275b7ed55a66e2e44daf707e6c267 Mon Sep 17 00:00:00 2001 From: Butch Wesley Date: Fri, 27 Jan 2017 22:17:18 -0500 Subject: [PATCH 17/17] version bump and some readme --- README.md | 2 +- test/gut/gut.gd | 2 +- test/gut/gut_cmdln.gd | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 55908abd..85ea168c 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ These methods would be used inside the Scene's script (`templates/gut_main.gd`) # Extras ## Strict type checking -Gut performs type checks in the asserts where it applies. This is done for a few reasons. The first is that invalid comparisons can cause runtime errors which will stop your tests from running. With the type checking enabled your test will fail instead of crashing. The other reason is that you can get false positives/negatives when comparing things like a Real/Float and an Integer. With strict type checking enabled these become a lot more obvious. It's also a sanity check to make sure your classes are using the expected types of values which can save time in the long run. +Gut performs type checks in the asserts when comparing two differnt types would normally cause a runtime error. With the type checking enabled (on be default) your test will fail instead of crashing. Some types are ok to be compared such as Floats and Integers but if you attempt to compare a String with a Float your test will fail instead of blowing up. You can disable this behavior if you like by calling `tester.disable_strict_datatype_checks(true)` inside `gut_main.gd`. diff --git a/test/gut/gut.gd b/test/gut/gut.gd index b18ebde4..b898c9b1 100644 --- a/test/gut/gut.gd +++ b/test/gut/gut.gd @@ -28,7 +28,7 @@ ################################################################################ # View readme for usage details. # -# Version 3.0 +# Version 3.1 ################################################################################ extends WindowDialog diff --git a/test/gut/gut_cmdln.gd b/test/gut/gut_cmdln.gd index 01ef30fd..d2ae995c 100644 --- a/test/gut/gut_cmdln.gd +++ b/test/gut/gut_cmdln.gd @@ -37,7 +37,7 @@ # See the readme for a list of options and examples. You can also use the -gh # option to get more information about how to use the command line interface. # -# Version 3.0 +# Version 3.1 ################################################################################ extends SceneTree