openrat-cms

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

test.js (2738B)


      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}, "dylan");
      6   function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
      7 
      8   MT('comments',
      9      '[comment // This is a line comment]',
     10      '[comment /* This is a block comment */]',
     11      '[comment /* This is a multi]',
     12      '[comment line comment]',
     13      '[comment */]',
     14      '[comment /* And this is a /*]',
     15      '[comment /* nested */ comment */]');
     16 
     17   MT('unary_operators',
     18      '[operator -][variable a]',
     19      '[operator -] [variable a]',
     20      '[operator ~][variable a]',
     21      '[operator ~] [variable a]');
     22 
     23   MT('binary_operators',
     24      '[variable a] [operator +] [variable b]',
     25      '[variable a] [operator -] [variable b]',
     26      '[variable a] [operator *] [variable b]',
     27      '[variable a] [operator /] [variable b]',
     28      '[variable a] [operator ^] [variable b]',
     29      '[variable a] [operator =] [variable b]',
     30      '[variable a] [operator ==] [variable b]',
     31      '[variable a] [operator ~=] [variable b]',
     32      '[variable a] [operator ~==] [variable b]',
     33      '[variable a] [operator <] [variable b]',
     34      '[variable a] [operator <=] [variable b]',
     35      '[variable a] [operator >] [variable b]',
     36      '[variable a] [operator >=] [variable b]',
     37      '[variable a] [operator &] [variable b]',
     38      '[variable a] [operator |] [variable b]',
     39      '[variable a] [operator :=] [variable b]');
     40 
     41   MT('integers',
     42      '[number 1]',
     43      '[number 123]',
     44      '[number -123]',
     45      '[number +456]',
     46      '[number #b010]',
     47      '[number #o073]',
     48      '[number #xabcDEF123]');
     49 
     50   MT('floats',
     51      '[number .3]',
     52      '[number -1.]',
     53      '[number -2.335]',
     54      '[number +3.78d1]',
     55      '[number 3.78s-1]',
     56      '[number -3.32e+5]');
     57 
     58   MT('characters_and_strings',
     59      "[string 'a']",
     60      "[string '\\\\'']",
     61      '[string ""]',
     62      '[string "a"]',
     63      '[string "abc def"]',
     64      '[string "More escaped characters: \\\\\\\\ \\\\a \\\\b \\\\e \\\\f \\\\n \\\\r \\\\t \\\\0 ..."]');
     65 
     66   MT('brackets',
     67      '[bracket #[[]]]',
     68      '[bracket #()]',
     69      '[bracket #(][number 1][bracket )]',
     70      '[bracket [[][number 1][punctuation ,] [number 3][bracket ]]]',
     71      '[bracket ()]',
     72      '[bracket {}]',
     73      '[keyword if] [bracket (][variable foo][bracket )]',
     74      '[bracket (][number 1][bracket )]',
     75      '[bracket [[][number 1][bracket ]]]');
     76 
     77   MT('hash_words',
     78      '[punctuation ##]',
     79      '[atom #f]', '[atom #F]',
     80      '[atom #t]', '[atom #T]',
     81      '[atom #all-keys]',
     82      '[atom #include]',
     83      '[atom #key]',
     84      '[atom #next]',
     85      '[atom #rest]',
     86      '[string #"foo"]',
     87      '[error #invalid]');
     88 })();