summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-12-28 17:15:22 -0600
committerJesse Luehrs <doy@tozt.net>2012-12-28 17:15:22 -0600
commita5e691813e5ffc37142186a352a48eaf9a5bb564 (patch)
treee36d9b7ee644d6d4739d377364d88208eaa240d3
parentf86a68225d9a06750d75a25a1de9f194a35ee523 (diff)
downloadp6-bread-board-a5e691813e5ffc37142186a352a48eaf9a5bb564.tar.gz
p6-bread-board-a5e691813e5ffc37142186a352a48eaf9a5bb564.zip
another test
-rw-r--r--t/025_sugar_w_absolute_path.t62
1 files changed, 62 insertions, 0 deletions
diff --git a/t/025_sugar_w_absolute_path.t b/t/025_sugar_w_absolute_path.t
new file mode 100644
index 0000000..ca9a08a
--- /dev/null
+++ b/t/025_sugar_w_absolute_path.t
@@ -0,0 +1,62 @@
+use v6;
+use Test;
+
+use Bread::Board;
+
+class MyApp::Schema { }
+class MyApp::View::TT { }
+
+my $c = container 'Application', {
+ container 'Model', {
+ service 'dsn', '';
+ service 'schema', (
+ class => MyApp::Schema,
+ dependencies => {
+ dsn => depends_on('dsn'),
+ user => depends_on('user'),
+ pass => depends_on('pass'),
+ },
+ );
+ };
+ container 'View', {
+ service 'TT', (
+ class => MyApp::View::TT,
+ dependencies => {
+ tt_include_path => depends_on('include_path'),
+ };
+ );
+ };
+ container 'Controller';
+};
+
+my $model = $c.fetch('Model');
+isa_ok($model, Bread::Board::Container);
+is($model.name, 'Model');
+
+{
+ my $model2 = $c.fetch('/Model');
+ isa_ok($model2, Bread::Board::Container);
+ is($model, $model2);
+}
+
+my $dsn = $model.fetch('schema/dsn');
+isa_ok($dsn, Bread::Board::Dependency);
+is($dsn.service_path, 'dsn');
+
+{
+ my $dsn2 = $c.fetch('/Model/schema/dsn');
+ isa_ok($dsn2, Bread::Board::Dependency);
+ is($dsn, $dsn2);
+}
+
+my $root = $model.fetch('..');
+isa_ok($root, Bread::Board::Container);
+is($root, $c);
+
+is($model, $model.fetch('../Model'));
+is($dsn, $model.fetch('../Model/schema/dsn'));
+is($model, $dsn.fetch('../Model'));
+
+done;
+
+# vim:ft=perl6:foldmethod=manual