Skip to content

Commit

Permalink
fix(kernel): correctly serialize enum values
Browse files Browse the repository at this point in the history
When string-valued enums were serialized, an incorrect reference would
be created if the label of the enum entry did not match it's string
value; due to the lookup code being incorrect.

Updated a string-valued enum and introduced new compliance tests to
ensure such enum values are passed across correctly.

Fixes #753
  • Loading branch information
RomainMuller committed Aug 29, 2019
1 parent fafb14f commit 1694d36
Show file tree
Hide file tree
Showing 16 changed files with 1,133 additions and 858 deletions.
20 changes: 17 additions & 3 deletions packages/jsii-calc/lib/compliance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,23 @@ export enum AllTypesEnum {
}

export enum StringEnum {
A = 'A',
B = 'B',
C = 'C'
A = 'A!',
B = 'B?',
C = 'C.'
}

export class EnumDispenser {
public static randomStringLikeEnum(): StringEnum {
// Haha! I lied, it's not random!! *EVIL LAUGHTER*
return StringEnum.B;
}

public static randomIntegerLikeEnum(): AllTypesEnum {
// Haha! I lied, it's not random!! *EVIL LAUGHTER*
return AllTypesEnum.YOUR_ENUM_VALUE;
}

private constructor() { }
}

/**
Expand Down
Loading

0 comments on commit 1694d36

Please sign in to comment.