@@ -100,6 +100,9 @@ sub copy_source_file
100
100
my $is_xsl = 0;
101
101
$is_xsl = 1 if ($from =~ / .xsl$ / );
102
102
103
+ my $is_test = 0;
104
+ $is_test = 1 if ($from =~ / tests\/ unit/ );
105
+
103
106
# Open the files.
104
107
open (my $input , " <$from " ) or die (" Can't open $from for reading" );
105
108
open (my $output , " >$to " ) or die (" Can't open $to for writing" );
@@ -180,22 +183,29 @@ sub copy_source_file
180
183
print_line($output , $1 . " <boost/" . $2 . " >" , $from , $lineno );
181
184
if ($uses_asio_thread )
182
185
{
183
- print_line($output , $1 . " <boost/thread/thread.hpp>" , $from , $lineno );
186
+ print_line($output , $1 . " <boost/thread/thread.hpp>" , $from , $lineno ) if (! $is_test ) ;
184
187
$uses_asio_thread = 0;
185
188
}
186
189
}
187
190
elsif ($line =~ / ^(# *include )[<"]boost\/ .*[>"].*$ / )
188
191
{
189
192
if (!$includes_asio && $uses_asio_thread )
190
193
{
191
- print_line($output , $1 . " <boost/thread/thread.hpp>" , $from , $lineno );
194
+ print_line($output , $1 . " <boost/thread/thread.hpp>" , $from , $lineno ) if (! $is_test ) ;
192
195
$uses_asio_thread = 0;
193
196
}
194
197
print_line($output , $line , $from , $lineno );
195
198
}
196
- elsif ($line =~ / # *include [<"]asio\/ thread\. hpp[>"]/ )
199
+ elsif ($line =~ / ^( # *include ) [<"]asio\/ thread\. hpp[>"]/ )
197
200
{
198
- # Line is removed.
201
+ if ($is_test )
202
+ {
203
+ print_line($output , $1 . " <boost/asio/detail/thread.hpp>" , $from , $lineno );
204
+ }
205
+ else
206
+ {
207
+ # Line is removed.
208
+ }
199
209
}
200
210
elsif ($line =~ / (# *include )[<"]asio\/ error_code\. hpp[>"]/ )
201
211
{
@@ -234,7 +244,14 @@ sub copy_source_file
234
244
}
235
245
elsif ($line =~ / asio::thread/ )
236
246
{
237
- $line =~ s / asio::thread/ boost::thread/ g ;
247
+ if ($is_test )
248
+ {
249
+ $line =~ s / asio::thread/ asio::detail::thread/ g ;
250
+ }
251
+ else
252
+ {
253
+ $line =~ s / asio::thread/ boost::thread/ g ;
254
+ }
238
255
if (!($line =~ / boost::asio::/ ))
239
256
{
240
257
$line =~ s / asio::/ boost::asio::/ g ;
@@ -243,11 +260,14 @@ sub copy_source_file
243
260
}
244
261
elsif ($line =~ / ^( *)thread( .*)$ / && !$is_qbk )
245
262
{
246
- if (!( $line =~ / boost::asio:: / ) )
263
+ if ($is_test )
247
264
{
248
- $line =~ s / asio::/ boost::asio::/ g ;
265
+ print_line($output , $1 . " boost::asio::detail::thread" . $2 , $from , $lineno );
266
+ }
267
+ else
268
+ {
269
+ print_line($output , $1 . " boost::thread" . $2 , $from , $lineno );
249
270
}
250
- print_line($output , $1 . " boost::thread" . $2 , $from , $lineno );
251
271
}
252
272
elsif ($line =~ / namespace std {/ )
253
273
{
0 commit comments