@@ -21,53 +21,53 @@ var _current_test_name = null
2121
2222
2323func  _ready ():
24- 	 simple_setup ()
25- 	 #  complex_setup()
24+      simple_setup ()
25+      #  complex_setup()
2626
2727
2828func  simple_setup ():
29- 	 #  You must load a gut config file to use this control.  Here we are loading
30- 	 #  the default config file used by the command line.  You can use any config
31- 	 #  file you have created.  Use the "save as" button in the Settings subpanel
32- 	 #  to create a config file, or write your own.
33- 	 # 
34- 	 #  Some settings may not work.  For example, the exit flags do not have any
35- 	 #  effect.
36- 	 # 
37- 	 #  Settings are not saved, so any changes will be lost. The idea is that you
38- 	 #  want to deploy the settings and users should not be able to save them.  If
39- 	 #  you want to save changes, you can call:
40- 	 #  	_gut_control.get_config().write_options(path).
41- 	 #  Note that you cannot to write to res:// on mobile platforms, so you will
42- 	 #  have to juggle the initial loading from res:// or user:// and save to
43- 	 #  user://.
44- 	 _gut_control .load_config_file ('res://.gutconfig.json' )
45- 
46- 	 #  That's it.  Just get a reference to the control you added to the scene and
47- 	 #  give it a config.  The rest of the stuff in this script optional.
29+      #  You must load a gut config file to use this control.  Here we are loading
30+      #  the default config file used by the command line.  You can use any config
31+      #  file you have created.  Use the "save as" button in the Settings subpanel
32+      #  to create a config file, or write your own.
33+      # 
34+      #  Some settings may not work.  For example, the exit flags do not have any
35+      #  effect.
36+      # 
37+      #  Settings are not saved, so any changes will be lost. The idea is that you
38+      #  want to deploy the settings and users should not be able to save them.  If
39+      #  you want to save changes, you can call:
40+      #  	_gut_control.get_config().write_options(path).
41+      #  Note that you cannot to write to res:// on mobile platforms, so you will
42+      #  have to juggle the initial loading from res:// or user:// and save to
43+      #  user://.
44+      _gut_control .load_config_file ('res://.gutconfig.json' )
45+ 
46+      #  That's it.  Just get a reference to the control you added to the scene and
47+      #  give it a config.  The rest of the stuff in this script optional.
4848
4949
5050
5151func  complex_setup ():
52- 	 #  See simple setup
53- 	 _gut_control .load_config_file ('res://.gutconfig.json' )
52+      #  See simple setup
53+      _gut_control .load_config_file ('res://.gutconfig.json' )
5454
55- 	 #  Returns a gut_config.gd instance.
56- 	 var  config  =  _gut_control .get_config ()
55+      #  Returns a gut_config.gd instance.
56+      var  config  =  _gut_control .get_config ()
5757
58- 	 #  Override specific values for the purposes of this scene.  You can see all
59- 	 #  the options available in the default_options dictionary in gut_config.gd.
60- 	 #  Changing settings AFTER _ready will not have any effect.
61- 	 config .options .should_exit  =  false 
62- 	 config .options .should_exit_on_success  =  false 
63- 	 config .options .compact_mode  =  false 
64- 	 #  Note that if you are exporting xml results you may want to set the path to
65- 	 #  a file in user:// instead of an absolute path.  Your game may not have
66- 	 #  permissions to save files elsewhere when running on a mobile device.
67- 	 config .options .junit_xml_file  =  'user://deployed_results.xml' 
58+      #  Override specific values for the purposes of this scene.  You can see all
59+      #  the options available in the default_options dictionary in gut_config.gd.
60+      #  Changing settings AFTER _ready will not have any effect.
61+      config .options .should_exit  =  false 
62+      config .options .should_exit_on_success  =  false 
63+      config .options .compact_mode  =  false 
64+      #  Note that if you are exporting xml results you may want to set the path to
65+      #  a file in user:// instead of an absolute path.  Your game may not have
66+      #  permissions to save files elsewhere when running on a mobile device.
67+      config .options .junit_xml_file  =  'user://deployed_results.xml' 
6868
69- 	 #  Some actions cannot be done until after _ready has finished in all objects
70- 	 _post_ready_setup .call_deferred ()
69+      #  Some actions cannot be done until after _ready has finished in all objects
70+      _post_ready_setup .call_deferred ()
7171
7272
7373
@@ -76,63 +76,63 @@ func complex_setup():
7676#  so after _ready.  This is an example of getting a reference to gut and all
7777#  of the signals it provides.
7878func  _post_ready_setup ():
79- 	 var  gut  =  _gut_control .get_gut ()
80- 	 gut .start_run .connect (_on_gut_run_start )
79+      var  gut  =  _gut_control .get_gut ()
80+      gut .start_run .connect (_on_gut_run_start )
8181
82- 	 gut .start_script .connect (_on_gut_start_script )
83- 	 gut .end_script .connect (_on_gut_end_script )
82+      gut .start_script .connect (_on_gut_start_script )
83+      gut .end_script .connect (_on_gut_end_script )
8484
85- 	 gut .start_test .connect (_on_gut_start_test )
86- 	 gut .end_test .connect (_on_gut_end_test )
85+      gut .start_test .connect (_on_gut_start_test )
86+      gut .end_test .connect (_on_gut_end_test )
8787
88- 	 gut .end_run .connect (_on_gut_run_end )
88+      gut .end_run .connect (_on_gut_run_end )
8989
9090
9191#  -----------------------
9292#  Events
9393#  -----------------------
9494func  _on_gut_run_start ():
95- 	 print ('Starting tests' )
95+      print ('Starting tests' )
9696
9797
9898#  This signal passes a TestCollector.gd/TestScript instance
9999func  _on_gut_start_script (script_obj ):
100- 	 print (script_obj .get_full_name (), ' has ' , script_obj .tests .size (), ' tests' )
101- 	 _current_script_object  =  script_obj 
100+      print (script_obj .get_full_name (), ' has ' , script_obj .tests .size (), ' tests' )
101+      _current_script_object  =  script_obj 
102102
103103
104104func  _on_gut_end_script ():
105- 	 var  pass_count  =  0 
106- 	 for  test  in  _current_script_object .tests :
107- 		 if (test .did_pass ()):
108- 			 pass_count  +=  1 
109- 	 print (pass_count , '/' , _current_script_object .tests .size (), " passed\n " )
110- 	 _current_script_object  =  null 
105+      var  pass_count  =  0 
106+      for  test  in  _current_script_object .tests :
107+          if (test .did_pass ()):
108+              pass_count  +=  1 
109+      print (pass_count , '/' , _current_script_object .tests .size (), " passed\n " )
110+      _current_script_object  =  null 
111111
112112
113113func  _on_gut_start_test (test_name ):
114- 	 _current_test_name  =  test_name 
115- 	 print ('  ' , test_name )
114+      _current_test_name  =  test_name 
115+      print ('  ' , test_name )
116116
117117
118118func  _on_gut_end_test ():
119- 	 #  get_test_named returns a TestCollector.gd/Test instance for the name
120- 	 #  passed in.
121- 	 var  test_object  =  _current_script_object .get_test_named (_current_test_name )
122- 	 var  status  =  "failed" 
123- 	 if (test_object .did_pass ()):
124- 		 status  =  "passed" 
125- 	 elif (test_object .pending ):
126- 		 status  =  "pending" 
119+      #  get_test_named returns a TestCollector.gd/Test instance for the name
120+      #  passed in.
121+      var  test_object  =  _current_script_object .get_test_named (_current_test_name )
122+      var  status  =  "failed" 
123+      if (test_object .did_pass ()):
124+          status  =  "passed" 
125+      elif (test_object .pending ):
126+          status  =  "pending" 
127127
128- 	 print ('    ' , status )
129- 	 _current_test_name  =  null 
128+      print ('    ' , status )
129+      _current_test_name  =  null 
130130
131131
132132func  _on_gut_run_end ():
133- 	 print ('Tests Done' )
133+      print ('Tests Done' )
134134
135135
136136#  You can kick of the tests via code if you want.
137137func  _on_run_gut_tests_button_pressed ():
138- 	 _gut_control .run_tests ()
138+      _gut_control .run_tests ()
0 commit comments