Skip to content

Commit

Permalink
Merge pull request #17 from DoclerLabs/develop
Browse files Browse the repository at this point in the history
prepare 0.34.0
  • Loading branch information
aliokan authored Jan 15, 2018
2 parents d40b6ac + 0b93935 commit 142f786
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 27 deletions.
5 changes: 2 additions & 3 deletions test/hex/log/LoggerTest.hx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package hex.log;

import hex.log.helper.TestLogger;
import hex.log.helper.TestLoggerContext;
import hex.log.message.ParameterizedMessageFactory;
import hex.log.message.SimpleMessageFactory;
import hex.unittest.assertion.Assert;



class LoggerTest
{

Expand Down Expand Up @@ -75,7 +74,7 @@ class LoggerTest
Assert.equals("DEBUG {}", testLogger.entries.first(), "Incorrect message");
}

public static var levelsDataProvider:Array<Array<LogLevel>> = [for (level in LogLevel.LEVELS) [level]];
public static var levelsDataProvider:Array<LogLevel> = LogLevel.LEVELS;

@Test("Test is level enabled")
@DataProvider("levelsDataProvider")
Expand Down
46 changes: 22 additions & 24 deletions test/hex/log/message/ParameterizedMessageTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,33 @@ class ParameterizedMessageTest
{
}

public static var parameters:Array<Array<Dynamic>> = [
["Test message {}", null, "Test message {}"],
["Test message {}", [], "Test message null"],
["", null, ""],
["", [], ""],
["d", null, "d"],
["d", [], "d"],
["{}", null, "{}"],
["{}", [], "null"],
["{}", ["a"], "a"],
["{}", [null], "null"],
["{ }", ["a"], "a"],
["Test message {}{} {}", ["a", "b", "c"], "Test message ab c"],
["Test message {}{} {}", [null, null, null], "Test message nullnull null"],
["Test message {}{} {}", [null, "b", null], "Test message nullb null"],
["Test message {} {} {} {} {}", ["a", null, "c", null, null], "Test message a null c null null"],
["Test message {}{} {}Text", ["a", "b", "c"], "Test message ab cText"],
["Test message {}{} {}", ["a", "b", "c", "unnecessary", "superfluous"], "Test message ab c"],
["Test message {}{} {}", ["a", "b"], "Test message ab null"]
public static var parameters:Array<{message:String, params:Array<Dynamic>, expectedMessage:String}> = [
{message:"Test message {}", params:null, expectedMessage:"Test message {}"},
{message:"Test message {}", params:[], expectedMessage:"Test message null"},
{message:"", params:null, expectedMessage:""},
{message:"", params:[], expectedMessage:""},
{message:"d", params:null, expectedMessage:"d"},
{message:"d", params:[], expectedMessage:"d"},
{message:"{}", params:null, expectedMessage:"{}"},
{message:"{}", params:[], expectedMessage:"null"},
{message:"{}", params:["a"], expectedMessage:"a"},
{message:"{}", params:[null], expectedMessage:"null"},
{message:"{ }", params:["a"], expectedMessage:"a"},
{message:"Test message {}{} {}", params:["a", "b", "c"], expectedMessage:"Test message ab c"},
{message:"Test message {}{} {}", params:[null, null, null], expectedMessage:"Test message nullnull null"},
{message:"Test message {}{} {}", params:[null, "b", null], expectedMessage:"Test message nullb null"},
{message:"Test message {} {} {} {} {}", params:["a", null, "c", null, null], expectedMessage:"Test message a null c null null"},
{message:"Test message {}{} {}Text", params:["a", "b", "c"], expectedMessage:"Test message ab cText"},
{message:"Test message {}{} {}", params:["a", "b", "c", "unnecessary", "superfluous"], expectedMessage:"Test message ab c"},
{message:"Test message {}{} {}", params:["a", "b"], expectedMessage:"Test message ab null"}
];

@Test("Test parameters replacement")
@DataProvider("parameters")
public function testParameters(message:String, params:Array<Dynamic>, expectedMessage:String)
public function testParameters(o:{message:String, params:Array<Dynamic>, expectedMessage:String})
{
var msg = new ParameterizedMessage(message, params);
var msg = new ParameterizedMessage(o.message, o.params);
var result = msg.getFormattedMessage();
Assert.equals(expectedMessage, result, "Messages must be the same");
Assert.equals(o.expectedMessage, result, "Messages must be the same");
}


}

0 comments on commit 142f786

Please sign in to comment.