SOURCE CODE: Uize.Test.Uize.Parse.JavaProperties.Comment

VIEW REFERENCE

/*______________
|       ______  |   U I Z E    J A V A S C R I P T    F R A M E W O R K
|     /      /  |   ---------------------------------------------------
|    /    O /   |    MODULE : Uize.Test.Uize.Parse.JavaProperties.Comment Class
|   /    / /    |
|  /    / /  /| |    ONLINE : http://uize.com
| /____/ /__/_| | COPYRIGHT : (c)2014 UIZE
|          /___ |   LICENSE : Available under MIT License or GNU General Public License
|_______________|             http://uize.com/license.html
*/

/* Module Meta Data
  type: Test
  importance: 1
  codeCompleteness: 100
  docCompleteness: 100
*/

/*?
  Introduction
    The =Uize.Test.Uize.Parse.JavaProperties.Comment= module defines a suite of unit tests for the =Uize.Parse.JavaProperties.Comment= module.

    *DEVELOPERS:* `Chris van Rensburg`
*/

Uize.module ({
  name:'Uize.Test.Uize.Parse.JavaProperties.Comment',
  superclass:'Uize.Test.ParserTest',
  builder:function (_superclass) {
    'use strict';

    return _superclass.subclass ({
      staticProperties:{parserClass:'Uize.Parse.JavaProperties.Comment'},

      set:{
        title:'Test for Uize.Parse.JavaProperties.Comment Module',
        test:[
          Uize.Test.requiredModulesTest ('Uize.Parse.JavaProperties.Comment'),
          {
            title:'A comment can be parsed',
            test:[
              Uize.Test.ParserTest.parserTest (
                'A comment may start with a "#" (pound) character',
                ['#this is a comment'],
                {
                  comment:'this is a comment',
                  isValid:true
                }
              ),
              Uize.Test.ParserTest.parserTest (
                'A comment may start with an "!" (exclamation mark) character',
                ['!this is a comment'],
                {
                  comment:'this is a comment',
                  isValid:true
                }
              ),
              Uize.Test.ParserTest.parserTest (
                'A comment may not start with whitespace',
                [' !this is not a comment'],
                {
                  comment:'',
                  isValid:false
                }
              ),
              Uize.Test.ParserTest.parserTest (
                'A comment may not start with a character that is not a comment start character',
                ['this is not a comment'],
                {
                  comment:'',
                  isValid:false
                }
              ),
              Uize.Test.ParserTest.parserTest (
                'A comment is terminated by the first carriage return character',
                ['!this is a comment\r\r\r\n\n\nthis is not part of the comment'],
                {
                  comment:'this is a comment',
                  isValid:true
                }
              ),
              Uize.Test.ParserTest.parserTest (
                'A comment is terminated by the first linebreak character',
                ['!this is a comment\n\n\n\r\r\rthis is not part of the comment'],
                {
                  comment:'this is a comment',
                  isValid:true
                }
              )
            ]
          },
          {
            title:'A comment can be serialized',
            test:[
              Uize.Test.ParserTest.serializerTest (
                'When a comment is serialized, the "#" (pound) character is used as the default comment start character',
                {
                  comment:'this is a comment',
                  isValid:true
                },
                '#this is a comment'
              )
            ]
          }
        ]
      }
    });
  }
});