| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use FindBin; |
| 4 |
use lib "$FindBin::Bin/../../../"; |
| 5 |
use Test::More; |
| 6 |
use t::Util; |
| 7 |
|
| 8 |
our $TEST_SEPARATE_VERSION = 0; |
| 9 |
our $TEST_NOREQUIRE = 0; |
| 10 |
|
| 11 |
test('empty string', '', {}); |
| 12 |
test("line ".__LINE__, 'use Use::NoVersion;', { 'Use::NoVersion' => 0 }); |
| 13 |
test("line ".__LINE__, 'use Use::Version 0.50;', { 'Use::Version' => '0.50' }); |
| 14 |
test("line ".__LINE__, 'use Errno 0.50;', { 'Errno' => '0.50' }); |
| 15 |
test("line ".__LINE__, 'require Require;', { Require => 0 }); |
| 16 |
|
| 17 |
test("line ".__LINE__, |
| 18 |
'use Use::Version 0.50; use Use::Version 1.00;', |
| 19 |
{ |
| 20 |
'Use::Version' => '1.00', |
| 21 |
}, |
| 22 |
); |
| 23 |
|
| 24 |
test("line ".__LINE__, |
| 25 |
'use Use::Version 1.00; use Use::Version 0.50;', |
| 26 |
{ |
| 27 |
'Use::Version' => '1.00', |
| 28 |
}, |
| 29 |
); |
| 30 |
|
| 31 |
test("line ".__LINE__, |
| 32 |
'use Import::IgnoreAPI require => 1;', |
| 33 |
{ 'Import::IgnoreAPI' => 0 }, |
| 34 |
); |
| 35 |
|
| 36 |
test("line ".__LINE__, |
| 37 |
'no Import::IgnoreAPI require => 1;', |
| 38 |
undef, undef, undef, |
| 39 |
{ 'Import::IgnoreAPI' => 0 }, |
| 40 |
); |
| 41 |
|
| 42 |
test("line ".__LINE__, 'require Require; Require->VERSION(0.50);', { Require => '0.50' }); |
| 43 |
|
| 44 |
test("line ".__LINE__, 'use Require; Require->VERSION(0.50);', { Require => '0.50' }); |
| 45 |
|
| 46 |
test("line ".__LINE__, 'require Require; Require->VERSION(+0.50);', { Require => 0 }); |
| 47 |
|
| 48 |
test("line ".__LINE__, 'require Require; foo(); Require->VERSION(1.00);', { Require => 0 }) if $TEST_SEPARATE_VERSION; |
| 49 |
|
| 50 |
test("line ".__LINE__, |
| 51 |
'require Require; Require->VERSION(v1.0.50);', |
| 52 |
{ Require => 'v1.0.50' } |
| 53 |
); |
| 54 |
|
| 55 |
test("line ".__LINE__, |
| 56 |
q{require Require; Require->VERSION('v1.0.50');}, |
| 57 |
{ Require => 'v1.0.50' } |
| 58 |
); |
| 59 |
|
| 60 |
test("line ".__LINE__, |
| 61 |
'require Require; Require->VERSION(q[1.00]);', |
| 62 |
{ Require => '1.00' } |
| 63 |
); |
| 64 |
|
| 65 |
test("line ".__LINE__, |
| 66 |
'require Require; Require::Other->VERSION(1.00);', |
| 67 |
{ Require => 0 } |
| 68 |
); |
| 69 |
|
| 70 |
test('require with comment', |
| 71 |
<<'END REQUIRE WITH COMMENT', |
| 72 |
require Require::This; # this comment shouldn't matter |
| 73 |
Require::This->VERSION(0.450); |
| 74 |
END REQUIRE WITH COMMENT |
| 75 |
{ 'Require::This' => '0.450' } |
| 76 |
); |
| 77 |
|
| 78 |
test("line ".__LINE__, |
| 79 |
'require Require; Require->VERSION(0.450) if some_condition; ', |
| 80 |
{ 'Require' => 0 } |
| 81 |
); |
| 82 |
|
| 83 |
# Moose features |
| 84 |
# (added 'use Moose;' to everything to trigger Moose parsers) |
| 85 |
test("line ".__LINE__, |
| 86 |
'use Moose; extends "Foo::Bar";', |
| 87 |
{ |
| 88 |
'Moose' => 0, |
| 89 |
'Foo::Bar' => 0, |
| 90 |
}, |
| 91 |
); |
| 92 |
|
| 93 |
test("line ".__LINE__, |
| 94 |
'use Moose; extends "Foo::Bar"; extends "Foo::Baz";', |
| 95 |
{ |
| 96 |
'Moose' => 0, |
| 97 |
'Foo::Bar' => 0, |
| 98 |
'Foo::Baz' => 0, |
| 99 |
}, |
| 100 |
); |
| 101 |
test("line ".__LINE__, "use Moose; with 'With::Single';", { 'Moose' => 0, 'With::Single' => 0 }); |
| 102 |
test("line ".__LINE__, |
| 103 |
"use Moose; extends 'Extends::List1', 'Extends::List2';", |
| 104 |
{ |
| 105 |
'Moose' => 0, |
| 106 |
'Extends::List1' => 0, |
| 107 |
'Extends::List2' => 0, |
| 108 |
}, |
| 109 |
); |
| 110 |
|
| 111 |
test("line ".__LINE__, "use Moose; within('With::Single');", { Moose => 0 }); |
| 112 |
|
| 113 |
test("line ".__LINE__, |
| 114 |
"use Moose; with 'With::Single', 'With::Double';", |
| 115 |
{ |
| 116 |
'Moose' => 0, |
| 117 |
'With::Single' => 0, |
| 118 |
'With::Double' => 0, |
| 119 |
}, |
| 120 |
); |
| 121 |
|
| 122 |
test("line ".__LINE__, |
| 123 |
"use Moose; with 'With::Single' => { -excludes => 'method'}, 'With::Double';", |
| 124 |
{ |
| 125 |
'Moose' => 0, |
| 126 |
'With::Single' => 0, |
| 127 |
'With::Double' => 0, |
| 128 |
}, |
| 129 |
); |
| 130 |
|
| 131 |
test("line ".__LINE__, |
| 132 |
'use Moose; with ("With::QW1", "With::QW2");', |
| 133 |
{ |
| 134 |
'Moose' => 0, |
| 135 |
'With::QW1' => 0, |
| 136 |
'With::QW2' => 0, |
| 137 |
}, |
| 138 |
); |
| 139 |
|
| 140 |
test("line ".__LINE__, |
| 141 |
"use Moose; with('Paren::Role');", |
| 142 |
{ |
| 143 |
'Moose' => 0, |
| 144 |
'Paren::Role' => 0, |
| 145 |
}, |
| 146 |
); |
| 147 |
|
| 148 |
test("line ".__LINE__, |
| 149 |
'use Moose; with("With::QW1", "With::QW2");', |
| 150 |
{ |
| 151 |
'Moose' => 0, |
| 152 |
'With::QW1' => 0, |
| 153 |
'With::QW2' => 0, |
| 154 |
}, |
| 155 |
); |
| 156 |
|
| 157 |
test("line ".__LINE__, |
| 158 |
'use Moose; with qw(With::QW1 With::QW2);', |
| 159 |
{ |
| 160 |
'Moose' => 0, |
| 161 |
'With::QW1' => 0, |
| 162 |
'With::QW2' => 0, |
| 163 |
}, |
| 164 |
); |
| 165 |
|
| 166 |
test("line ".__LINE__, |
| 167 |
'use Moose; with "::Foo"', |
| 168 |
{ Moose => 0 }, |
| 169 |
); |
| 170 |
|
| 171 |
test("line ".__LINE__, |
| 172 |
'use Moose; extends qw(Extends::QW1 Extends::QW2);', |
| 173 |
{ |
| 174 |
'Moose' => 0, |
| 175 |
'Extends::QW1' => 0, |
| 176 |
'Extends::QW2' => 0, |
| 177 |
}, |
| 178 |
); |
| 179 |
|
| 180 |
test("line ".__LINE__, |
| 181 |
'use base "Base::QQ1";', |
| 182 |
{ |
| 183 |
'Base::QQ1' => 0, |
| 184 |
base => 0, |
| 185 |
}, |
| 186 |
); |
| 187 |
|
| 188 |
test("line ".__LINE__, |
| 189 |
'use base 10 "Base::QQ1";', |
| 190 |
{ |
| 191 |
'Base::QQ1' => 0, |
| 192 |
base => 10, |
| 193 |
}, |
| 194 |
); |
| 195 |
test("line ".__LINE__, |
| 196 |
'use base qw{ Base::QW1 Base::QW2 };', |
| 197 |
{ 'Base::QW1' => 0, 'Base::QW2' => 0, base => 0 }, |
| 198 |
); |
| 199 |
|
| 200 |
test("line ".__LINE__, |
| 201 |
'use parent "Parent::QQ1";', |
| 202 |
{ |
| 203 |
'Parent::QQ1' => 0, |
| 204 |
parent => 0, |
| 205 |
}, |
| 206 |
); |
| 207 |
|
| 208 |
test("line ".__LINE__, |
| 209 |
'use parent 10 "Parent::QQ1";', |
| 210 |
{ |
| 211 |
'Parent::QQ1' => 0, |
| 212 |
parent => 10, |
| 213 |
}, |
| 214 |
); |
| 215 |
|
| 216 |
test("line ".__LINE__, |
| 217 |
'use parent 2 "Parent::QQ1"; use parent 2 "Parent::QQ2"', |
| 218 |
{ |
| 219 |
'Parent::QQ1' => 0, |
| 220 |
'Parent::QQ2' => 0, |
| 221 |
parent => 2, |
| 222 |
}, |
| 223 |
); |
| 224 |
|
| 225 |
test("line ".__LINE__, |
| 226 |
'use parent 2 "Parent::QQ1"; use parent 1 "Parent::QQ2"', |
| 227 |
{ |
| 228 |
'Parent::QQ1' => 0, |
| 229 |
'Parent::QQ2' => 0, |
| 230 |
parent => 2, |
| 231 |
}, |
| 232 |
); |
| 233 |
|
| 234 |
test("line ".__LINE__, |
| 235 |
'use parent qw{ Parent::QW1 Parent::QW2 };', |
| 236 |
{ |
| 237 |
'Parent::QW1' => 0, |
| 238 |
'Parent::QW2' => 0, |
| 239 |
parent => 0, |
| 240 |
}, |
| 241 |
); |
| 242 |
|
| 243 |
# test case for #55713: support for use parent -norequire |
| 244 |
# ...but is this ok??? |
| 245 |
test("line ".__LINE__, |
| 246 |
'use parent -norequire, qw{ Parent::QW1 Parent::QW2 };', |
| 247 |
{ |
| 248 |
'Parent::QW1' => 0, |
| 249 |
'Parent::QW2' => 0, |
| 250 |
parent => 0, |
| 251 |
}, |
| 252 |
) if $TEST_NOREQUIRE; |
| 253 |
|
| 254 |
test("line ".__LINE__, |
| 255 |
'use superclass "superclass::QQ1";', |
| 256 |
{ |
| 257 |
'superclass::QQ1' => 0, |
| 258 |
superclass => 0, |
| 259 |
}, |
| 260 |
); |
| 261 |
|
| 262 |
test("line ".__LINE__, |
| 263 |
'use superclass 10 "superclass::QQ1", 1.23;', |
| 264 |
{ |
| 265 |
'superclass::QQ1' => 1.23, |
| 266 |
superclass => 10, |
| 267 |
}, |
| 268 |
); |
| 269 |
|
| 270 |
test("line ".__LINE__, |
| 271 |
'use superclass 2 "superclass::QQ1"; use superclass 2 "superclass::QQ2"', |
| 272 |
{ |
| 273 |
'superclass::QQ1' => 0, |
| 274 |
'superclass::QQ2' => 0, |
| 275 |
superclass => 2, |
| 276 |
}, |
| 277 |
); |
| 278 |
|
| 279 |
test("line ".__LINE__, |
| 280 |
'use superclass 2 "superclass::QQ1", "v1.2.3"; use superclass 1 "superclass::QQ1", "v1.2.4"', |
| 281 |
{ |
| 282 |
'superclass::QQ1' => "v1.2.4", |
| 283 |
superclass => 2, |
| 284 |
}, |
| 285 |
); |
| 286 |
|
| 287 |
test("line ".__LINE__, |
| 288 |
'use superclass qw{ superclass::QW1 1.23 };', |
| 289 |
{ |
| 290 |
'superclass::QW1' => 1.23, |
| 291 |
superclass => 0, |
| 292 |
}, |
| 293 |
); |
| 294 |
|
| 295 |
# test case for #55713: support for use superclass -norequire |
| 296 |
test("line ".__LINE__, |
| 297 |
'use superclass -norequire, qw{ superclass::QW1 superclass::QW2 };', |
| 298 |
{ |
| 299 |
'superclass::QW1' => 0, |
| 300 |
'superclass::QW2' => 0, |
| 301 |
superclass => 0, |
| 302 |
}, |
| 303 |
) if $TEST_NOREQUIRE; |
| 304 |
|
| 305 |
test("line ".__LINE__, |
| 306 |
'use superclass -norequire, "superclass::QW1" => 1.23, "superclass::QW2";', |
| 307 |
{ |
| 308 |
'superclass::QW1' => 1.23, |
| 309 |
'superclass::QW2' => 0, |
| 310 |
superclass => 0, |
| 311 |
}, |
| 312 |
) if $TEST_NOREQUIRE; |
| 313 |
|
| 314 |
# test case for #55851: require $foo |
| 315 |
test("line ".__LINE__, |
| 316 |
'my $foo = "Carp"; require $foo', |
| 317 |
{}, |
| 318 |
); |
| 319 |
|
| 320 |
test("line ".__LINE__, |
| 321 |
q{use strict; use warnings; use lib '.'; use feature ':5.10';}, |
| 322 |
{ strict => 0, warnings => 0, lib => 0, feature => 0 }, |
| 323 |
); |
| 324 |
|
| 325 |
test("line ".__LINE__, |
| 326 |
q{use Test::More; is 0, 1; done_testing}, |
| 327 |
{ |
| 328 |
'Test::More' => '0.88', |
| 329 |
}, |
| 330 |
); |
| 331 |
|
| 332 |
# test cases for Moose 1.03 -version extension |
| 333 |
test("line ".__LINE__, |
| 334 |
'use Moose; extends "Foo::Bar"=>{-version=>"1.1"};', |
| 335 |
{ |
| 336 |
'Moose' => 0, |
| 337 |
'Foo::Bar' => '1.1', |
| 338 |
}, |
| 339 |
); |
| 340 |
|
| 341 |
test("line ".__LINE__, |
| 342 |
'use Moose; extends "Foo::Bar" => { -version => \'1.1\' };', |
| 343 |
{ |
| 344 |
'Moose' => 0, |
| 345 |
'Foo::Bar' => '1.1', |
| 346 |
}, |
| 347 |
); |
| 348 |
|
| 349 |
test("line ".__LINE__, |
| 350 |
'use Moose; extends "Foo::Bar" => { -version => 13.3 };', |
| 351 |
{ |
| 352 |
'Moose' => 0, |
| 353 |
'Foo::Bar' => '13.3', |
| 354 |
}, |
| 355 |
); |
| 356 |
|
| 357 |
test("line ".__LINE__, |
| 358 |
'use Moose; extends "Foo::Bar" => { -version => \'1.1\' }; extends "Foo::Baz" => { -version => 5 };', |
| 359 |
{ |
| 360 |
'Moose' => 0, |
| 361 |
'Foo::Bar' => '1.1', |
| 362 |
'Foo::Baz' => 5, |
| 363 |
}, |
| 364 |
); |
| 365 |
|
| 366 |
test("line ".__LINE__, |
| 367 |
'use Moose; extends "Foo::Bar"=>{-version=>1},"Foo::Baz"=>{-version=>2};', |
| 368 |
{ |
| 369 |
'Moose' => 0, |
| 370 |
'Foo::Bar' => 1, |
| 371 |
'Foo::Baz' => 2, |
| 372 |
}, |
| 373 |
); |
| 374 |
|
| 375 |
test("line ".__LINE__, |
| 376 |
'use Moose; extends "Foo::Bar" => { -version => "4.3.2" }, "Foo::Baz" => { -version => 2.44894 };', |
| 377 |
{ |
| 378 |
'Moose' => 0, |
| 379 |
'Foo::Bar' => 'v4.3.2', |
| 380 |
'Foo::Baz' => 2.44894, |
| 381 |
}, |
| 382 |
); |
| 383 |
|
| 384 |
test("line ".__LINE__, |
| 385 |
'use Moose; with "With::Single" => { -excludes => "method", -version => "1.1.1" }, "With::Double";', |
| 386 |
{ |
| 387 |
'Moose' => 0, |
| 388 |
'With::Single' => 'v1.1.1', |
| 389 |
'With::Double' => 0, |
| 390 |
}, |
| 391 |
); |
| 392 |
|
| 393 |
test("line ".__LINE__, |
| 394 |
'use Moose; with "With::Single" => { -wow => { -wow => { a => b } }, -version => "1.1.1" }, "With::Double";', |
| 395 |
{ |
| 396 |
'Moose' => 0, |
| 397 |
'With::Single' => 'v1.1.1', |
| 398 |
'With::Double' => 0, |
| 399 |
}, |
| 400 |
); |
| 401 |
|
| 402 |
test("line ".__LINE__, |
| 403 |
'use Moose; with "With::Single" => { -exclude => "method", -version => "1.1.1" }, |
| 404 |
"With::Double" => { -exclude => "foo" };', |
| 405 |
{ |
| 406 |
'Moose' => 0, |
| 407 |
'With::Single' => 'v1.1.1', |
| 408 |
'With::Double' => 0, |
| 409 |
}, |
| 410 |
); |
| 411 |
|
| 412 |
test("line ".__LINE__, |
| 413 |
'use Moose; with("Foo::Bar");', |
| 414 |
{ |
| 415 |
'Moose' => 0, |
| 416 |
'Foo::Bar' => 0, |
| 417 |
}, |
| 418 |
); |
| 419 |
|
| 420 |
test("line ".__LINE__, |
| 421 |
'use Moose; with( "Foo::Bar" );', |
| 422 |
{ |
| 423 |
'Moose' => 0, |
| 424 |
'Foo::Bar' => 0, |
| 425 |
}, |
| 426 |
); |
| 427 |
|
| 428 |
test("line ".__LINE__, |
| 429 |
'use Moose; with( "Foo::Bar", "Bar::Baz" );', |
| 430 |
{ |
| 431 |
'Moose' => 0, |
| 432 |
'Foo::Bar' => 0, |
| 433 |
'Bar::Baz' => 0, |
| 434 |
} |
| 435 |
); |
| 436 |
|
| 437 |
test("line ".__LINE__, |
| 438 |
'use Moose; with( "Foo::Bar" => { -version => "1.1" }, |
| 439 |
"Bar::Baz" );', |
| 440 |
{ |
| 441 |
'Moose' => 0, |
| 442 |
'Foo::Bar' => '1.1', |
| 443 |
'Bar::Baz' => 0, |
| 444 |
} |
| 445 |
); |
| 446 |
|
| 447 |
test("line ".__LINE__, |
| 448 |
'use Moose; with( "Blam::Blam", "Foo::Bar" => { -version => "1.1" }, |
| 449 |
"Bar::Baz" );', |
| 450 |
{ |
| 451 |
'Moose' => 0, |
| 452 |
'Blam::Blam' => 0, |
| 453 |
'Foo::Bar' => '1.1', |
| 454 |
'Bar::Baz' => 0, |
| 455 |
} |
| 456 |
); |
| 457 |
|
| 458 |
test("line ".__LINE__, |
| 459 |
'use Moose; with("Blam::Blam","Foo::Bar"=>{-version=>"1.1"}, |
| 460 |
"Bar::Baz" );', |
| 461 |
{ |
| 462 |
'Moose' => 0, |
| 463 |
'Blam::Blam' => 0, |
| 464 |
'Foo::Bar' => '1.1', |
| 465 |
'Bar::Baz' => 0, |
| 466 |
} |
| 467 |
); |
| 468 |
|
| 469 |
test("line ".__LINE__, |
| 470 |
'use Moose; with("Blam::Blam","Foo::Bar"=>{-version=>"1.1"}, |
| 471 |
"Bar::Baz", |
| 472 |
"Hoopla" => { -version => 1 } );', |
| 473 |
{ |
| 474 |
'Moose' => 0, |
| 475 |
'Blam::Blam' => 0, |
| 476 |
'Foo::Bar' => '1.1', |
| 477 |
'Bar::Baz' => 0, |
| 478 |
'Hoopla' => 1, |
| 479 |
} |
| 480 |
); |
| 481 |
|
| 482 |
test("line ".__LINE__, |
| 483 |
'use Moose; extends("Foo::Bar");', |
| 484 |
{ |
| 485 |
'Moose' => 0, |
| 486 |
'Foo::Bar' => 0, |
| 487 |
}, |
| 488 |
); |
| 489 |
|
| 490 |
test("line ".__LINE__, |
| 491 |
'use Moose; extends( "Foo::Bar" );', |
| 492 |
{ |
| 493 |
'Moose' => 0, |
| 494 |
'Foo::Bar' => 0, |
| 495 |
}, |
| 496 |
); |
| 497 |
|
| 498 |
test("line ".__LINE__, |
| 499 |
'use Moose; extends( "Foo::Bar", "Bar::Baz" );', |
| 500 |
{ |
| 501 |
'Moose' => 0, |
| 502 |
'Foo::Bar' => 0, |
| 503 |
'Bar::Baz' => 0, |
| 504 |
} |
| 505 |
); |
| 506 |
|
| 507 |
test("line ".__LINE__, |
| 508 |
'use Moose; extends( "Foo::Bar" => { -version => "1.1" }, |
| 509 |
"Bar::Baz" );', |
| 510 |
{ |
| 511 |
'Moose' => 0, |
| 512 |
'Foo::Bar' => '1.1', |
| 513 |
'Bar::Baz' => 0, |
| 514 |
} |
| 515 |
); |
| 516 |
|
| 517 |
test("line ".__LINE__, |
| 518 |
'use Moose; extends( "Blam::Blam", "Foo::Bar" => { -version => "1.1" }, |
| 519 |
"Bar::Baz" );', |
| 520 |
{ |
| 521 |
'Moose' => 0, |
| 522 |
'Blam::Blam' => 0, |
| 523 |
'Foo::Bar' => '1.1', |
| 524 |
'Bar::Baz' => 0, |
| 525 |
} |
| 526 |
); |
| 527 |
|
| 528 |
test("line ".__LINE__, |
| 529 |
'use Moose; extends("Blam::Blam","Foo::Bar"=>{-version=>"1.1"}, |
| 530 |
"Bar::Baz" );', |
| 531 |
{ |
| 532 |
'Moose' => 0, |
| 533 |
'Blam::Blam' => 0, |
| 534 |
'Foo::Bar' => '1.1', |
| 535 |
'Bar::Baz' => 0, |
| 536 |
} |
| 537 |
); |
| 538 |
|
| 539 |
test("line ".__LINE__, |
| 540 |
'use Moose; extends("Blam::Blam","Foo::Bar"=>{-version=>"1.1"}, |
| 541 |
"Bar::Baz", |
| 542 |
"Hoopla" => { -version => 1 } );', |
| 543 |
{ |
| 544 |
'Moose' => 0, |
| 545 |
'Blam::Blam' => 0, |
| 546 |
'Foo::Bar' => '1.1', |
| 547 |
'Bar::Baz' => 0, |
| 548 |
'Hoopla' => 1, |
| 549 |
} |
| 550 |
); |
| 551 |
|
| 552 |
test("line ".__LINE__, |
| 553 |
'use Moose ;with( |
| 554 |
\'AAA\' => { -version => \'1\' }, |
| 555 |
\'BBB\' => { -version => \'2.1\' }, |
| 556 |
\'CCC\' => { |
| 557 |
-version => \'4.012345\', |
| 558 |
default_finders => [ \':InstallModules\', \':ExecFiles\' ], |
| 559 |
}, |
| 560 |
);', |
| 561 |
{ |
| 562 |
'Moose' => 0, |
| 563 |
'AAA' => 1, |
| 564 |
'BBB' => '2.1', |
| 565 |
'CCC' => '4.012345', |
| 566 |
}, |
| 567 |
); |
| 568 |
|
| 569 |
test("line ".__LINE__, |
| 570 |
'use Moose; with( |
| 571 |
"AAA" |
| 572 |
=> |
| 573 |
{ |
| 574 |
-version |
| 575 |
=> |
| 576 |
1 |
| 577 |
}, |
| 578 |
);', |
| 579 |
{ |
| 580 |
'Moose' => 0, |
| 581 |
'AAA' => 1, |
| 582 |
}, |
| 583 |
); |
| 584 |
|
| 585 |
test("line ".__LINE__, |
| 586 |
'use Moose; with |
| 587 |
"AAA" |
| 588 |
=> |
| 589 |
{ |
| 590 |
-version |
| 591 |
=> |
| 592 |
1 |
| 593 |
};', |
| 594 |
{ |
| 595 |
'Moose' => 0, |
| 596 |
'AAA' => 1, |
| 597 |
}, |
| 598 |
); |
| 599 |
|
| 600 |
test("line ".__LINE__, |
| 601 |
'use Moose; with( |
| 602 |
|
| 603 |
"Bar" |
| 604 |
|
| 605 |
);', |
| 606 |
{ |
| 607 |
'Moose' => 0, |
| 608 |
'Bar' => 0, |
| 609 |
}, |
| 610 |
); |
| 611 |
|
| 612 |
test("line ".__LINE__, |
| 613 |
'use Moose; with |
| 614 |
|
| 615 |
\'Bar\' |
| 616 |
|
| 617 |
;', |
| 618 |
{ |
| 619 |
'Moose' => 0, |
| 620 |
'Bar' => 0, |
| 621 |
}, |
| 622 |
); |
| 623 |
|
| 624 |
# invalid code tests |
| 625 |
test("line ".__LINE__, 'use Moose; with;', {Moose => 0}, ); |
| 626 |
test("line ".__LINE__, 'use Moose; with foo;', {Moose => 0} ); |
| 627 |
|
| 628 |
# test cases for aliased.pm |
| 629 |
test("line ".__LINE__, |
| 630 |
q{use aliased 'Long::Custom::Class::Name'}, |
| 631 |
{ |
| 632 |
'aliased' => 0, |
| 633 |
'Long::Custom::Class::Name' => 0, |
| 634 |
}, |
| 635 |
); |
| 636 |
|
| 637 |
test("line ".__LINE__, |
| 638 |
q{use aliased 0.30 'Long::Custom::Class::Name'}, |
| 639 |
{ |
| 640 |
'aliased' => '0.30', |
| 641 |
'Long::Custom::Class::Name' => 0, |
| 642 |
}, |
| 643 |
); |
| 644 |
|
| 645 |
|
| 646 |
test("line ".__LINE__, |
| 647 |
q{use aliased 'Long::Custom::Class::Name' => 'Name'}, |
| 648 |
{ |
| 649 |
'aliased' => 0, |
| 650 |
'Long::Custom::Class::Name' => 0, |
| 651 |
}, |
| 652 |
); |
| 653 |
|
| 654 |
test("line ".__LINE__, |
| 655 |
q{use aliased;}, |
| 656 |
{ |
| 657 |
'aliased' => 0, |
| 658 |
}, |
| 659 |
); |
| 660 |
|
| 661 |
# rolsky says this is a problem case |
| 662 |
test("line ".__LINE__, |
| 663 |
q{use Test::Requires 'Foo'}, |
| 664 |
{ |
| 665 |
'Test::Requires' => 0, |
| 666 |
}, |
| 667 |
); |
| 668 |
|
| 669 |
# test cases for POE |
| 670 |
test("line ".__LINE__, |
| 671 |
q{use POE 'Component::IRC'}, |
| 672 |
{ |
| 673 |
'POE' => 0, |
| 674 |
'POE::Component::IRC' => 0, |
| 675 |
}, |
| 676 |
); |
| 677 |
|
| 678 |
test("line ".__LINE__, |
| 679 |
q{use POE qw/Component::IRC Component::Server::NNTP/}, |
| 680 |
{ |
| 681 |
'POE' => 0, |
| 682 |
'POE::Component::IRC' => 0, |
| 683 |
'POE::Component::Server::NNTP' => 0, |
| 684 |
}, |
| 685 |
); |
| 686 |
|
| 687 |
done_testing; |