2020package ;
2121
2222import org .apache .thrift .* ;
23+ import org .apache .thrift .meta_data .* ;
2324import org .apache .thrift .protocol .* ;
24- import org .apache .thrift .transport .* ;
2525import org .apache .thrift .server .* ;
26- import org .apache .thrift .meta_data .* ;
27-
28- import thrift .test .* ; // generated code
29-
26+ import org .apache .thrift .transport .* ;
27+ import tests .ConstantsTest ;
28+ import tests .MultiplexTest ;
29+ import tests .StreamTest ;
30+ import thrift .test .* ;
3031
31- enum WhatTests {
32- Normal ;
33- Multiplex ;
34- Constants ;
32+ enum WhatTests
33+ {
34+ Normal ;
35+ Multiplex ;
36+ Constants ;
3537}
3638
3739class Main
3840{
39- static private var tests : WhatTests = Normal ;
40- static private var server : Bool = false ;
41+ static private var what : WhatTests = Normal ;
42+ static private var server : Bool = false ;
4143
42- static private inline var CMDLINEHELP : String
43- = " \n HaxeTests [client|server] [multiplex]\n "
44- + " client|server ... determines run mode for some tests, default is client\n "
45- + " multiplex ........ run multiplex test server or client\n " ;
44+ static private inline var CMDLINEHELP : String
45+ = " \n HaxeTests [client|server] [multiplex]\n "
46+ + " client|server ... determines run mode for some tests, default is client\n "
47+ + " multiplex ........ run multiplex test server or client\n "
48+ + " constants ........ run constants and conformity tests\n "
49+ ;
4650
47- static private function ParseArgs () {
48- #if sys
51+ static private function ParseArgs ()
52+ {
53+ #if sys
4954
50- var args = Sys .args ();
51- if ( args != null ) {
52- for ( arg in args ) {
53- switch (arg .toLowerCase ()) {
54- case " client" :
55- server = false ;
56- case " server" :
57- server = true ;
58- case " multiplex" :
59- tests = Multiplex ;
60- case " constants" :
61- tests = Constants ;
62- default :
63- throw ' Invalid argument " $arg " \n ' + CMDLINEHELP ;
64- }
65- }
66- }
55+ var args = Sys .args ();
56+ if ( args != null )
57+ {
58+ for ( arg in args )
59+ {
60+ switch (arg .toLowerCase ())
61+ {
62+ case " client" :
63+ server = false ;
64+ case " server" :
65+ server = true ;
66+ case " multiplex" :
67+ what = Multiplex ;
68+ case " constants" :
69+ what = Constants ;
70+ default :
71+ throw ' Invalid argument " $arg " \n ' + CMDLINEHELP ;
72+ }
73+ }
74+ }
6775
68- #end
69- }
76+ #end
77+ }
7078
71- static public function main ()
72- {
73- try
74- {
75- ParseArgs ();
79+ static public function main ()
80+ {
81+ try
82+ {
83+ ParseArgs ();
7684
77- switch ( tests ) {
78- case Normal :
79- #if sys
80- StreamTest . Run (server );
81- #end
82- case Multiplex :
83- #if ! (flash || html5 || js)
84- MultiplexTest . Run (server );
85- #end
86- case Constants :
87- ConstantsTest . Run (server );
88- default :
89- throw " Unhandled test mode $tests" ;
90- }
85+ switch ( what )
86+ {
87+ case Normal :
88+ #if sys
89+ tests. StreamTest . Run (server );
90+ #end
91+ case Multiplex :
92+ #if ! (flash || html5 || js)
93+ tests. MultiplexTest . Run (server );
94+ #end
95+ case Constants :
96+ tests. ConstantsTest . Run (server );
97+ default :
98+ throw ' Unhandled test mode $what ' ;
99+ }
91100
92- trace (" All tests completed." );
93- }
94- catch ( e : Dynamic )
95- {
96- trace (' $e ' );
97- #if sys
98- Sys .exit (1 ); // indicate error
99- #end
100- }
101- }
101+ trace (" All tests completed." );
102+ }
103+ catch ( e : Dynamic )
104+ {
105+ trace (' $e ' );
106+ #if sys
107+ Sys .exit (1 ); // indicate error
108+ #end
109+ }
110+ }
102111}
0 commit comments