|
45 | 45 | DcuOutputDir adds -N0 flag. |
46 | 46 | UnitSearchPath single entry adds -U flag; multiple joined with semicolons. |
47 | 47 | IncludePath single entry adds -I flag; multiple joined with semicolons. |
| 48 | + Define omitted adds no extra -D argument beyond the config define. |
| 49 | + Define single entry adds a -D flag with that value. |
| 50 | + Define multiple entries are joined with semicolons into a single -D flag. |
48 | 51 |
|
49 | 52 | Describe 8 - Main flow (via Invoke-ToolProcess, no DCC calls): |
50 | 53 | Exits 3 when no rootDir is provided (no pipeline, no -RootDir). |
@@ -667,6 +670,81 @@ Describe 'Invoke-DccProject' { |
667 | 670 |
|
668 | 671 | } |
669 | 672 |
|
| 673 | + Context 'Define omitted adds no extra -D argument beyond the config define' { |
| 674 | + |
| 675 | + BeforeAll { |
| 676 | + $script:capturedArgs = $null |
| 677 | + Mock Invoke-DccExe { |
| 678 | + $script:capturedArgs = $Arguments |
| 679 | + return [pscustomobject]@{ ExitCode = 0; Output = '' } |
| 680 | + } |
| 681 | + |
| 682 | + Invoke-DccProject ` |
| 683 | + -CompilerPath 'C:\RAD\Studio\23.0\bin\dcc32.exe' ` |
| 684 | + -ProjectFile 'C:\Projects\MyApp.dpr' ` |
| 685 | + -Config 'Debug' ` |
| 686 | + -Target 'Build' ` |
| 687 | + -Verbosity 'normal' |
| 688 | + } |
| 689 | + |
| 690 | + It 'contains exactly one -D argument (the config define)' { |
| 691 | + @($script:capturedArgs | Where-Object { $_ -like '-D*' }).Count | Should -Be 1 |
| 692 | + } |
| 693 | + |
| 694 | + It 'the only -D argument is -DDEBUG' { |
| 695 | + $script:capturedArgs | Should -Contain '-DDEBUG' |
| 696 | + } |
| 697 | + |
| 698 | + } |
| 699 | + |
| 700 | + Context 'Define single entry adds a -D flag with that value' { |
| 701 | + |
| 702 | + BeforeAll { |
| 703 | + $script:capturedArgs = $null |
| 704 | + Mock Invoke-DccExe { |
| 705 | + $script:capturedArgs = $Arguments |
| 706 | + return [pscustomobject]@{ ExitCode = 0; Output = '' } |
| 707 | + } |
| 708 | + |
| 709 | + Invoke-DccProject ` |
| 710 | + -CompilerPath 'C:\RAD\Studio\23.0\bin\dcc32.exe' ` |
| 711 | + -ProjectFile 'C:\Projects\MyApp.dpr' ` |
| 712 | + -Config 'Debug' ` |
| 713 | + -Target 'Build' ` |
| 714 | + -Verbosity 'normal' ` |
| 715 | + -Define @('MYFLAG') |
| 716 | + } |
| 717 | + |
| 718 | + It 'includes -DMYFLAG' { |
| 719 | + $script:capturedArgs | Should -Contain '-DMYFLAG' |
| 720 | + } |
| 721 | + |
| 722 | + } |
| 723 | + |
| 724 | + Context 'Define multiple entries are joined with semicolons into a single -D flag' { |
| 725 | + |
| 726 | + BeforeAll { |
| 727 | + $script:capturedArgs = $null |
| 728 | + Mock Invoke-DccExe { |
| 729 | + $script:capturedArgs = $Arguments |
| 730 | + return [pscustomobject]@{ ExitCode = 0; Output = '' } |
| 731 | + } |
| 732 | + |
| 733 | + Invoke-DccProject ` |
| 734 | + -CompilerPath 'C:\RAD\Studio\23.0\bin\dcc32.exe' ` |
| 735 | + -ProjectFile 'C:\Projects\MyApp.dpr' ` |
| 736 | + -Config 'Debug' ` |
| 737 | + -Target 'Build' ` |
| 738 | + -Verbosity 'normal' ` |
| 739 | + -Define @('MYFLAG', 'USE_JEDI_JCL') |
| 740 | + } |
| 741 | + |
| 742 | + It 'includes -DMYFLAG;USE_JEDI_JCL as a single argument' { |
| 743 | + $script:capturedArgs | Should -Contain '-DMYFLAG;USE_JEDI_JCL' |
| 744 | + } |
| 745 | + |
| 746 | + } |
| 747 | + |
670 | 748 | } |
671 | 749 |
|
672 | 750 | Describe 'Main flow -- pre-compiler validation (no DCC invoked)' { |
|
0 commit comments