Permalink
Browse files

Tighten up tests for #37 to add strict mode as well

  • Loading branch information...
1 parent c406139 commit 47578578f1fff771dfba5641fc2a57f97247a97f @seancorfield committed Apr 6, 2013
Showing with 37 additions and 2 deletions.
  1. +37 −2 tests/defaultarg.cfc
View
@@ -12,17 +12,52 @@ component extends="mxunit.framework.TestCase" {
}
function checkDefaultInitArgThreeArgs() {
- var factory = new ioc( "/tests/model", { constants = { dsn = "sample" } } );
+ var factory = new ioc( "/tests/model",
+ { constants = { dsn = "sample" } } );
var user37c = factory.getBean( "user37c" );
assertEquals( "sample", user37c.getDSN() );
assertEquals( 0, user37c.getID() );
assertEquals( "Bob", user37c.getName() );
- factory = new ioc( "/tests/model", { constants = { dsn = "sample", name="John" } } );
+ factory = new ioc( "/tests/model",
+ { constants = { dsn = "sample", name = "John" } } );
user37c = factory.getBean( "user37c" );
assertEquals( "sample", user37c.getDSN() );
assertEquals( 0, user37c.getID() );
assertEquals( "John", user37c.getName() );
}
+
+ function checkDefaultInitArgWorksStrict() {
+ var factory = new ioc( "/tests/model",
+ { strict = true,
+ constants = { dsn = "sample" } } );
+ var user37 = factory.getBean( "user37" );
+ assertEquals( "sample", user37.getDSN() );
+ assertEquals( 0, user37.getID() );
+
+ var user37b = factory.getBean( "user37b" );
+ assertEquals( "sample", user37b.getDSN() );
+ assertEquals( 0, user37b.getID() );
+ }
+
+ function checkDefaultInitArgThreeArgsStrict() {
+ var factory = new ioc( "/tests/model",
+ { strict = true,
+ constants = { dsn = "sample" } } );
+ var user37c = factory.getBean( "user37c" );
+ assertEquals( "sample", user37c.getDSN() );
+ assertEquals( 0, user37c.getID() );
+ assertEquals( "Bob", user37c.getName() );
+
+ factory = new ioc( "/tests/model",
+ { strict = true,
+ constants = { dsn = "sample", name = "John" } } );
+ user37c = factory.getBean( "user37c" );
+ assertEquals( "sample", user37c.getDSN() );
+ assertEquals( 0, user37c.getID() );
+ assertEquals( "John", user37c.getName() );
+
+ }
+
}

0 comments on commit 4757857

Please sign in to comment.