summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-12-28 17:44:43 -0600
committerJesse Luehrs <doy@tozt.net>2012-12-28 17:44:43 -0600
commitacd81a059abac533c0af5ff31b0d672f7f3f2bc1 (patch)
treef00c8079ee2ee4b6ab8f4ef4b9960085ce1cc4d7
parent9f0615943cad69433a241a00f392b7e5c8df171a (diff)
downloadp6-bread-board-acd81a059abac533c0af5ff31b0d672f7f3f2bc1.tar.gz
p6-bread-board-acd81a059abac533c0af5ff31b0d672f7f3f2bc1.zip
another test
-rw-r--r--t/028_sugar_w_recursive_inc.t33
-rw-r--r--t/lib/my_app.bb22
2 files changed, 55 insertions, 0 deletions
diff --git a/t/028_sugar_w_recursive_inc.t b/t/028_sugar_w_recursive_inc.t
new file mode 100644
index 0000000..47a1b09
--- /dev/null
+++ b/t/028_sugar_w_recursive_inc.t
@@ -0,0 +1,33 @@
+use v6;
+use Test;
+
+use Bread::Board;
+
+my $DIR = $*PROGRAM_NAME.split('/')[0..*-2].join('/');
+
+class FileLogger {
+ has $.log_file;
+}
+
+class MyApplication {
+ has FileLogger $.logger;
+}
+
+my $c = include "$DIR/lib/my_app.bb";
+
+my $logger = $c.resolve(service => 'logger');
+isa_ok($logger, FileLogger);
+is($logger.log_file, 'logfile.log');
+
+is($c.fetch('logger/log_file').service, $c.fetch('log_file'));
+is($c.fetch('logger/log_file').get, 'logfile.log');
+
+my $app = $c.resolve(service => 'application');
+isa_ok($app, MyApplication);
+
+isa_ok($app.logger, FileLogger);
+is($app.logger, $logger);
+
+done;
+
+# vim:ft=perl6:foldmethod=manual
diff --git a/t/lib/my_app.bb b/t/lib/my_app.bb
new file mode 100644
index 0000000..b84e895
--- /dev/null
+++ b/t/lib/my_app.bb
@@ -0,0 +1,22 @@
+use v6;
+
+use Bread::Board;
+
+say $*PROGRAM_NAME;
+my $DIR = $*PROGRAM_NAME.split('/')[0..*-2].join('/');
+
+container 'MyApp', {
+
+ service 'log_file', "logfile.log";
+
+ include "$DIR/lib/logger.bb";
+
+ service 'application', (
+ class => MyApplication,
+ dependencies => {
+ logger => depends_on('logger'),
+ }
+ );
+};
+
+# vim:ft=perl6:foldmethod=manual