Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/tla2tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ export function extractFingerprintFromTrace(traceFilePath: string): number | und
export async function buildTlcOptions(tlaFilePath: string, cfgFilePath: string, customOptions: string[]): Promise<string[]> {
const custOpts = customOptions.map((opt) => {
return opt
.replace(VAR_TLC_SPEC_NAME, path.basename(tlaFilePath, '.tla'))
.replace(VAR_TLC_MODEL_NAME, path.basename(cfgFilePath, '.cfg'));
.replace(VAR_TLC_SPEC_NAME, path.parse(tlaFilePath).name)
.replace(VAR_TLC_MODEL_NAME, path.parse(cfgFilePath).name);
});
const opts = [path.basename(tlaFilePath), '-tool', '-modelcheck'];
addValueOrDefault('-config', cfgFilePath, custOpts, opts);
Expand Down
28 changes: 28 additions & 0 deletions tests/suite/tla2tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,34 @@ suite('TLA+ Tools Test Suite', () => {
assert.strictEqual(result[dumpIdx + 2], 'bar.dot');
});

test('Strips .tla extension from modelName when CONFIG is embedded (regression for #483)', async () => {
const result = await buildTlcOptions(
'/path/to/HourClock.tla',
'/path/to/HourClock.tla',
['-dump', 'dot,colorize,actionlabels', '${modelName}.dot']
);
assert.strictEqual(result[0], 'HourClock.tla');
assert.ok(result.includes('-dump'));
const dumpIdx = result.indexOf('-dump');
assert.strictEqual(result[dumpIdx + 1], 'dot,colorize,actionlabels');
assert.strictEqual(result[dumpIdx + 2], 'HourClock.dot',
'modelName should expand to HourClock.dot, not HourClock.tla.dot');
});

test('Strips .tla extension from specName when CONFIG is embedded', async () => {
const result = await buildTlcOptions(
'/path/to/HourClock.tla',
'/path/to/HourClock.tla',
['-dump', 'dot', '${specName}.dot']
);
assert.strictEqual(result[0], 'HourClock.tla');
assert.ok(result.includes('-dump'));
const dumpIdx = result.indexOf('-dump');
assert.strictEqual(result[dumpIdx + 1], 'dot');
assert.strictEqual(result[dumpIdx + 2], 'HourClock.dot',
'specName should expand to HourClock.dot, not HourClock.tla.dot');
});

test('Provides default classpath and GC in Java options', async () => {
assert.deepEqual(
buildJavaOptions(
Expand Down
Loading