1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
19 var test_host
= "localhost"
21 # Return a new port for each instance
24 return 10000+20000.rand
37 # Hide testing concept to force nitcorn to actually run
38 "NIT_TESTING".setenv
("false")
40 app
.listen
(host
, port
)
51 redef fun main
do return null
53 # Regex to catch and hide the port from the output to get consistent results
54 var host_re
: Regex = "localhost:\[0-9\]+".to_re
56 fun system
(cmd
: String, title
: nullable String)
58 title
= title
or else cmd
59 title
= title
.replace
(host_re
, "localhost:*****")
60 print
"\n[Client] {title}"