-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from IBM/feature/bob_keep_attrs
Feature/bob_keep_attrs
- Loading branch information
Showing
3 changed files
with
114 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { assert, beforeAll, describe, expect, test } from 'vitest'; | ||
|
||
import { Targets } from '../src/targets' | ||
import path from 'path'; | ||
import { MakeProject } from '../src/builders/make'; | ||
import { getFiles } from '../src/utils'; | ||
import { setupFixture } from './fixtures/projects'; | ||
import { scanGlob } from '../src/extensions'; | ||
import { writeFileSync } from 'fs'; | ||
import { BobProject } from '../src'; | ||
|
||
const cwd = setupFixture(`pseudo`); | ||
|
||
// This issue was occuring when you had two files with the same name, but different extensions. | ||
|
||
let files = getFiles(cwd, scanGlob); | ||
|
||
describe.skipIf(files.length === 0)(`bob Rules.mk tests`, () => { | ||
const targets = new Targets(cwd); | ||
targets.setSuggestions({ renames: true, includes: true }) | ||
|
||
beforeAll(async () => { | ||
targets.loadObjectsFromPaths(files); | ||
const parsePromises = files.map(f => targets.parseFile(f)); | ||
await Promise.all(parsePromises); | ||
|
||
expect(targets.getTargets().length).toBeGreaterThan(0); | ||
targets.resolveBinder(); | ||
}); | ||
|
||
test(`bob to not overwrite any pre-existing rules for targets`, () => { | ||
const project = new BobProject(targets); | ||
|
||
const files = project.createRules(); | ||
|
||
const baseRules = files[`Rules.mk`].split(`\n`); | ||
|
||
expect(baseRules).toBeDefined(); | ||
expect(baseRules[0]).toContain(`SUBDIRS =`); | ||
expect(baseRules[0]).toContain(`qobjs`); | ||
expect(baseRules[0]).toContain(`qrpglesrc`); | ||
|
||
const qobjRules = files[`qobjs/Rules.mk`].split(`\n`); | ||
|
||
expect(qobjRules).toBeDefined(); | ||
expect(qobjRules).toContain(`MYTHING.DTAARA:text=Hello world`); | ||
expect(qobjRules).toContain(`MSTDSP.FILE: mstdsp.dspf`); | ||
|
||
const qrpglesrcRules = files[`qrpglesrc/Rules.mk`].split(`\n`); | ||
|
||
expect(qrpglesrcRules).toBeDefined(); | ||
expect(qrpglesrcRules).toContain(`TESTER.PGM: tester.pgm.rpgle MYTHING.DTAARA`); | ||
expect(qrpglesrcRules).toContain(`TESTER.PGM: text = My program`); | ||
expect(qrpglesrcRules).toContain(`# Other assignment`); | ||
expect(qrpglesrcRules).toContain(`TESTER.PGM: bnddir:=MYBND`); | ||
expect(qrpglesrcRules).toContain(`OTHER.PGM: other.pgm.sqlrpgle MSTDSP.FILE`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters