Skip to content

Commit

Permalink
fix(jsii-diff): renaming a positional argument is a breaking change i…
Browse files Browse the repository at this point in the history
…n Python

Related: #2927
  • Loading branch information
RomainMuller committed Aug 4, 2021
1 parent a63b2e8 commit a996fe6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/jsii-diff/test/python.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { expectError } from './util';

// ----------------------------------------------------------------------

test.each([
['class', 'constructor'],
['class', 'method'],
['interface', 'method'],
])(
'not okay to rename a positional parameter',
(scope, decl) =>
expectError(
/positional parameter was renamed from 'previous' to 'current'/,
// Note: name is ITest so we're good for both class & interface... Yes, this is ugly.
`
export ${scope} ITest {
${decl}(previous: any)${decl === 'constructor' ? '' : ': void'}${scope === 'class' ? ' { previous.use(); }' : ';'}
}`,
`
export ${scope} ITest {
${decl}(current: any)${decl === 'constructor' ? '' : ': void'}${scope === 'class' ? ' { current.use(); }' : ';'}
}`,
),
);

0 comments on commit a996fe6

Please sign in to comment.