Rev | Line | |
---|
[483] | 1 | result = ""; |
---|
| 2 | |
---|
| 3 | /* For the purpose of these tests, we have no actual console with |
---|
| 4 | which to test output, so create a dummy console and capture to |
---|
| 5 | 'result', which is examined by the test framework post eval. */ |
---|
| 6 | var console = { |
---|
| 7 | log: function(arg) { result += "LOG: " + arg; }, |
---|
| 8 | debug: function(arg) { result += "DEBUG: " + arg; }, |
---|
| 9 | warn: function(arg) { result += "WARN: " + arg; }, |
---|
| 10 | error: function(arg) { result += "ERROR: " + arg; }, |
---|
| 11 | dir: function(arg) { result += "DIR: " + arg; } |
---|
| 12 | }; |
---|
| 13 | (function() { |
---|
| 14 | var fn = function(arg) { |
---|
| 15 | return "fn saw arg '" + arg + "'."; |
---|
| 16 | } |
---|
| 17 | var str = "wooo"; |
---|
| 18 | console.debug(str + "some \\ dodgy \" characters *$!?//" + (1+2) + (~2) + fn(str)); |
---|
| 19 | console.error(str + "some \\ dodgy \" characters *$!?//" + (1+2) + (~2) + fn(str)); |
---|
| 20 | |
---|
| 21 | // from ticket http://bugs.dojotoolkit.org/ticket/8549 |
---|
| 22 | console.log("hello :) world!"); |
---|
| 23 | console.log(" anything /) with a paren "); |
---|
| 24 | console.log(/^\)$/.test("hi")); |
---|
| 25 | |
---|
| 26 | //It would be interesting to see how this comes out: |
---|
| 27 | if(true) |
---|
| 28 | console.log("foo"); |
---|
| 29 | else |
---|
| 30 | var two = "two"; |
---|
| 31 | |
---|
| 32 | var bar; |
---|
| 33 | true ? console.log("bizarre") : (bar = true); |
---|
| 34 | true ? (bar = true) : console.log("bizarre"); |
---|
| 35 | |
---|
| 36 | (function() { |
---|
| 37 | return console.debug("Debug return statement."); |
---|
| 38 | })(); |
---|
| 39 | (function() { |
---|
| 40 | return console.error("Error return statement."); |
---|
| 41 | })(); |
---|
| 42 | })(); |
---|
Note: See
TracBrowser
for help on using the repository browser.