/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Ajax.org Code Editor (ACE).
 *
 * The Initial Developer of the Original Code is
 * Ajax.org B.V.
 * Portions created by the Initial Developer are Copyright (C) 2010
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *      quexer <quexer AT gmail DOT com>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

if (typeof process !== "undefined") {
    require("amd-loader");
}

define(function(require, exports, module) {
"use strict";

var Mode = require("./markdown").Mode;
var assert = require("../test/assertions");

module.exports = {
    setUp : function() {
        this.tokenizer = new Mode().getTokenizer();
    },

    "test: header 1 ": function() {
        var tokens = this.tokenizer.getLineTokens("#f", "start").tokens;
        assert.equal(tokens.length, 1);
        assert.equal(tokens[0].type, 'markup.heading.1');
    },

    "test: header 2": function() {
        var tokens = this.tokenizer.getLineTokens("## foo", "start").tokens;
        assert.equal(tokens.length, 1);
        assert.equal(tokens[0].type, 'markup.heading.2');
    },

    "test: header ends with ' #'": function() {
        var tokens = this.tokenizer.getLineTokens("# # # ", "start").tokens;
        assert.equal(tokens.length, 1);
        assert.equal(tokens[0].type, 'markup.heading.1');
    },

    "test: header ends with '#'": function() {
        var tokens = this.tokenizer.getLineTokens("#foo# ", "start").tokens;
        assert.equal(tokens.length, 1);
        assert.equal(tokens[0].type, 'markup.heading.1');
    },

    "test: 6+ #s is not a valid header": function() {
        var tokens = this.tokenizer.getLineTokens("####### foo", "start").tokens;
        assert.equal(tokens.length, 1);
        assert.equal(tokens[0].type, 'text');
    },

    "test: # followed be only space is not a valid header": function() {
        var tokens = this.tokenizer.getLineTokens("#  ", "start").tokens;
        assert.equal(tokens.length, 1);
        assert.equal(tokens[0].type, 'text');
    },



    "test: only space between #s is not a valid header": function() {
        var tokens = this.tokenizer.getLineTokens("#  #", "start").tokens;
        assert.equal(tokens.length, 1);
        assert.equal(tokens[0].type, 'text');
    }
};

});

if (typeof module !== "undefined" && module === require.main) {
    require("asyncjs").test.testcase(module.exports).exec();
}

@@ -35,1657 +35,1669 @@
 %0A * 
-Version: MPL 1.1/GPL 2.0/LGPL 2.1%0A *%0A * The contents of this file are subject to the Mozilla Public License Version%0A * 1.1 (the %22License%22); you may not use this file except in compliance with%0A * the License. You may obtain a copy of the License at%0A * http://www.mozilla.org/MPL/%0A *%0A * Software distributed under the License is distributed on an %22AS IS%22 basis,%0A * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License%0A * for the specific language governing rights and limitations under the%0A * License.%0A *%0A * The Original Code is Ajax.org Code Editor (ACE).%0A *%0A * The Initial Developer of the Original Code is%0A * Ajax.org B.V.%0A * Portions created by the Initial Developer are Copyright (C) 2010%0A * the Initial Developer. All Rights Reserved.%0A *%0A * Contributor(s):%0A *      quexer %3Cquexer AT gmail DOT com%3E%0A *%0A * Alternatively, the contents of this file may be used under the terms of%0A * either the GNU General Public License Version 2 or later (the %22GPL%22), or%0A * the GNU Lesser General Public License Version 2.1 or later (the %22LGPL%22),%0A * in which case the provisions of the GPL or the LGPL are applicable instead%0A * of those above. If you wish to allow use of your version of this file only%0A * under the terms of either the GPL or the LGPL, and not to allow others to%0A * use your version of this file under the terms of the MPL, indicate your%0A * decision by deleting the provisions above and replace them with the notice%0A * and other provisions required by the GPL or the LGPL. If you do not delete%0A * the provisions above, a recipient may use your version of this file under%0A * the terms of any one of the MPL, the GPL or the LGPL.
+Distributed under the BSD license:%0A *%0A * Copyright (c) 2012, Ajax.org B.V.%0A * All rights reserved.%0A *%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following conditions are met:%0A *     * Redistributions of source code must retain the above copyright%0A *       notice, this list of conditions and the following disclaimer.%0A *     * Redistributions in binary form must reproduce the above copyright%0A *       notice, this list of conditions and the following disclaimer in the%0A *       documentation and/or other materials provided with the distribution.%0A *     * Neither the name of Ajax.org B.V. nor the%0A *       names of its contributors may be used to endorse or promote products%0A *       derived from this software without specific prior written permission.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22 AND%0A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED%0A * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE%0A * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY%0A * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES%0A * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;%0A * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND%0A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT%0A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS%0A * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A *%0A *%0A * Contributor(s):%0A *%0A * quexer %3Cquexer AT gmail DOT com%3E
 %0A *%0A

update license block