All files / src version.ts

91.43% Statements 32/35
71.43% Branches 5/7
100% Functions 1/1
91.43% Lines 32/35

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 371x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 95x 95x 1x 1x 94x 94x 94x 94x 95x   95x     94x 94x 94x    
export enum Version {
  OpenABAP = "open-abap", // as 702, but with some extra new language features
  v700 = "v700",
  v702 = "v702",
  v740sp02 = "v740sp02",
  v740sp05 = "v740sp05",
  v740sp08 = "v740sp08",
  v750 = "v750",
  v751 = "v751",
  v752 = "v752",
  v753 = "v753",
  v754 = "v754",
  v755 = "v755",
  v756 = "v756",
  Cloud = "Cloud", // Steampunk, SAP BTP ABAP Environment
}
 
export const defaultVersion = Version.v755;
 
export function getPreviousVersion(v: Version): Version {
  if (v === Version.OpenABAP) {
    return Version.v702;
  }
 
  const all = Object.values(Version);
 
  const found = all.indexOf(v);
  if (found < 0) {
    throw "Unknown version: " + v;
  } else if (found === 0) {
    throw "Nothing lower: " + v;
  }
 
  return all[found - 1];
}