aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-elm.min.js
blob: 2fdcae9dbdd1bea4fb6aff37f327efb4776cad94 (plain)
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
Prism.languages.elm = {
  comment: /--.*|\{-[\s\S]*?-\}/,
  char: {
    pattern:
      /'(?:[^\\'\r\n]|\\(?:[abfnrtv\\']|\d+|x[0-9a-fA-F]+|u\{[0-9a-fA-F]+\}))'/,
    greedy: !0,
  },
  string: [
    { pattern: /"""[\s\S]*?"""/, greedy: !0 },
    { pattern: /"(?:[^\\"\r\n]|\\.)*"/, greedy: !0 },
  ],
  'import-statement': {
    pattern:
      /(^[\t ]*)import\s+[A-Z]\w*(?:\.[A-Z]\w*)*(?:\s+as\s+(?:[A-Z]\w*)(?:\.[A-Z]\w*)*)?(?:\s+exposing\s+)?/m,
    lookbehind: !0,
    inside: { keyword: /\b(?:as|exposing|import)\b/ },
  },
  keyword:
    /\b(?:alias|as|case|else|exposing|if|in|infixl|infixr|let|module|of|then|type)\b/,
  builtin:
    /\b(?:abs|acos|always|asin|atan|atan2|ceiling|clamp|compare|cos|curry|degrees|e|flip|floor|fromPolar|identity|isInfinite|isNaN|logBase|max|min|negate|never|not|pi|radians|rem|round|sin|sqrt|tan|toFloat|toPolar|toString|truncate|turns|uncurry|xor)\b/,
  number: /\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0x[0-9a-f]+)\b/i,
  operator: /\s\.\s|[+\-/*=.$<>:&|^?%#@~!]{2,}|[+\-/*=$<>:&|^?%#@~!]/,
  hvariable: /\b(?:[A-Z]\w*\.)*[a-z]\w*\b/,
  constant: /\b(?:[A-Z]\w*\.)*[A-Z]\w*\b/,
  punctuation: /[{}[\]|(),.:]/,
};
span> 'laudantium'; const value = 'laborum'; LocalStorage.set(key, value); expect(LocalStorage.get(key)).toBe(value); }); it('can update an existing key', () => { localStorage.clear(); const key = 'officiis'; const value = 'saepe'; LocalStorage.set(key, value); const newValue = 'itaque'; LocalStorage.set(key, newValue); expect(LocalStorage.get(key)).toBe(newValue); }); it('can remove a key from the storage', () => { localStorage.clear(); const key1 = 'ab'; const value1 = 'ipsum'; const key2 = 'suscipit'; const value2 = 'autem'; LocalStorage.set(key1, value1); LocalStorage.set(key2, value2); LocalStorage.remove(key1); expect(LocalStorage.get(key1)).toBeUndefined(); expect(LocalStorage.get(key2)).toBe(value2); }); it('can clear the storage', () => { localStorage.clear(); const key1 = 'velit'; const value1 = 'rerum'; const key2 = 'enim'; const value2 = 'consequatur'; LocalStorage.set(key1, value1); LocalStorage.set(key2, value2); LocalStorage.clear(); expect(LocalStorage.get(key1)).toBeUndefined(); expect(LocalStorage.get(key2)).toBeUndefined(); }); it('return undefined and log and error when the value is invalid', () => { const spy = jest.spyOn(console, 'error'); const key = 'dolor'; const value = 'possimus'; // The value is not stringified localStorage.setItem(key, value); expect(LocalStorage.get(key)).toBeUndefined(); expect(spy).toHaveBeenCalled(); }); it('does not set invalid value and log the error', () => { const spy = jest.spyOn(console, 'error'); const key = 'voluptatibus'; // eslint-disable-next-line @typescript-eslint/no-magic-numbers const value = BigInt(1234567890); LocalStorage.set(key, value); expect(LocalStorage.get(key)).toBeUndefined(); expect(spy).toHaveBeenCalled(); }); });