blob: b3b4acfff1646a300ec34a0d5bb1b8ee278d2630 [file] [log] [blame]
// All of these cases should produce IJ highlights where marked.
library highlighting.test;
const string bad_single_char_escape = "\q";
const string bad_octal = "octal \01";
const string bad_hex = "\x1 hex";
const string octal = "\017 octal";
const string hex = "\x12";
const string unicode_wrong_braces = "\u{}\u{\u1234";
const string slash_u_terminated = "\u";
const string too_much_unicode = "\u{cafe111}";
const string unicode_64 = "unicode code point \u{12abcd34}";
// Second `flexible` should be flagged.
type FlexibleCantRepeat = flexible flexible enum {
FOO = 1;
};
// Second `strict` should be flagged.
type StrictCantRepeat = strict strict enum {
FOO = 1;
};
// `flexible` should be flagged.
type StrictnessCantRepeat = strict flexible bits {
FOO = 1;
};
// Second `resource` should be flagged.
type ResourceCantRepeat = resource resource struct {};
// `resource` should be flagged.
type BitsCantBeResource = resource bits {
FOO = 1;
};
// `resource` should be flagged.
type EnumCantBeResource = resource enum {
FOO = 1;
};
// `flexible` should be flagged.
type StructCantHaveStrictness = flexible struct {};
// `strict` should be flagged.
type TableCantHaveStrictness = strict table {};
// `@foo` should be flagged.
type ReservedCantHaveAttribute = flexible union {
1: u1 bool;
@foo
2: reserved;
};
// `FOO = 0.1` should be flagged.
type BitsNotIntegral = strict bits {
FOO = 0.1;
};
// `FOO = 0.1` should be flagged.
type EnumNotIntegral = strict enum {
FOO = 0.1;
};
// `FOO = 3` should be flagged.
type BitsNotPowerOfTwo = flexible bits {
FOO = 3;
};
// FOO = 2048 should be flagged.
type TooBigEnumValue = strict enum : uint8 {
FOO = 2048;
};
// `int8` should be flagged.
type BitsSubtypeNotUnsignedIntegral = flexible bits : int8 {
FOO = 1;
};
// `bool` should be flagged.
type EnumSubtypeNotIntegral = flexible enum : bool {
FOO = 1;
};