openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

test.min.js (2959B)


      1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
      2 // Distributed under an MIT license: http://codemirror.net/LICENSE
      3 
      4 (function() {
      5   var mode = CodeMirror.getMode({indentUnit: 2}, "powershell");
      6   function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
      7 
      8   function forEach(arr, f) { for (var i = 0; i < arr.length; i++) f(arr[i], i) }
      9 
     10   MT('comment', '[number 1][comment # A]');
     11   MT('comment_multiline', '[number 1][comment <#]',
     12     '[comment ABC]',
     13   '[comment #>][number 2]');
     14 
     15   forEach([
     16     '0', '1234',
     17     '12kb', '12mb', '12Gb', '12Tb', '12PB', '12L', '12D', '12lkb', '12dtb',
     18     '1.234', '1.234e56', '1.', '1.e2', '.2', '.2e34',
     19     '1.2MB', '1.kb', '.1dTB', '1.e1gb', '.2', '.2e34',
     20     '0x1', '0xabcdef', '0x3tb', '0xelmb'
     21   ], function(number) {
     22     MT("number_" + number, "[number " + number + "]");
     23   });
     24 
     25   MT('string_literal_escaping', "[string 'a''']");
     26   MT('string_literal_variable', "[string 'a $x']");
     27   MT('string_escaping_1', '[string "a `""]');
     28   MT('string_escaping_2', '[string "a """]');
     29   MT('string_variable_escaping', '[string "a `$x"]');
     30   MT('string_variable', '[string "a ][variable-2 $x][string  b"]');
     31   MT('string_variable_spaces', '[string "a ][variable-2 ${x y}][string  b"]');
     32   MT('string_expression', '[string "a ][punctuation $(][variable-2 $x][operator +][number 3][punctuation )][string  b"]');
     33   MT('string_expression_nested', '[string "A][punctuation $(][string "a][punctuation $(][string "w"][punctuation )][string b"][punctuation )][string B"]');
     34 
     35   MT('string_heredoc', '[string @"]',
     36     '[string abc]',
     37   '[string "@]');
     38   MT('string_heredoc_quotes', '[string @"]',
     39     '[string abc "\']',
     40   '[string "@]');
     41   MT('string_heredoc_variable', '[string @"]',
     42     '[string a ][variable-2 $x][string  b]',
     43   '[string "@]');
     44   MT('string_heredoc_nested_string', '[string @"]',
     45     '[string a][punctuation $(][string "w"][punctuation )][string b]',
     46   '[string "@]');
     47   MT('string_heredoc_literal_quotes', "[string @']",
     48     '[string abc "\']',
     49   "[string '@]");
     50 
     51   MT('array', "[punctuation @(][string 'a'][punctuation ,][string 'b'][punctuation )]");
     52   MT('hash', "[punctuation @{][string 'key'][operator :][string 'value'][punctuation }]");
     53 
     54   MT('variable', "[variable-2 $test]");
     55   MT('variable_global',  "[variable-2 $global:test]");
     56   MT('variable_spaces',  "[variable-2 ${test test}]");
     57   MT('operator_splat',   "[variable-2 @x]");
     58   MT('variable_builtin', "[builtin $ErrorActionPreference]");
     59   MT('variable_builtin_symbols', "[builtin $$]");
     60 
     61   MT('operator', "[operator +]");
     62   MT('operator_unary', "[operator +][number 3]");
     63   MT('operator_long', "[operator -match]");
     64 
     65   forEach([
     66     '(', ')', '[[', ']]', '{', '}', ',', '`', ';', '.'
     67   ], function(punctuation) {
     68     MT("punctuation_" + punctuation.replace(/^[\[\]]/,''), "[punctuation " + punctuation + "]");
     69   });
     70 
     71   MT('keyword', "[keyword if]");
     72 
     73   MT('call_builtin', "[builtin Get-ChildItem]");
     74 })();