Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Trying to figure out tests, somethings not working right with them

  • Loading branch information...
commit ced051ff6596e37d6fcd53f7b15b06f7fffd5e0a 1 parent 858955a
@ashgti authored
View
3  .gitignore
@@ -0,0 +1,3 @@
+Makefile
+*.pir
+*.swp
View
3  Configure
@@ -0,0 +1,3 @@
+#!perl6
+use v6;
+use Configure;
View
5 Makefile → Makefile.in
@@ -1,5 +1,6 @@
-PERL6=perl6
-PERL6LIB='/Users/john/.perl6/lib'
+PERL6=<PERL6>
+RAKUDO_DIR=<RAKUDO_DIR>
+PERL6LIB='<PERL6LIB>:$(RAKUDO_DIR)'
SOURCES=lib/Endure.pm
View
25 lib/Endure.pm
@@ -1,5 +1,26 @@
+use v6;
+
module Endure;
-sub a {
- print 'a';
+role Resource {
+}
+
+role property {
}
+
+multi trait_mod:<is>(AttributeDeclarand $a, Endure::property, $type, %args = {}) {
+ $a.container.VAR does Endure::property;
+
+ #say 'type is: ', $type.WHAT;
+ #say 'args: ', %args;
+
+ say 'applied is trait';
+ #say ~$a.^methods;
+ #say ~$a.container.WHAT;
+ #say $_.name for $a.^attributes;
+
+ $a.container.VAR.type = $type;
+ $a.container.VAR.args = %args;
+}
+
+# vim: ft=perl6
View
5 lib/TestHelper.pm
@@ -0,0 +1,5 @@
+# A test helper file, to be useful later?
+
+use Test;
+
+
View
34 t/01-endure-basics.t
@@ -0,0 +1,34 @@
+use v6;
+use Test;
+
+plan 2;
+
+use Endure;
+
+ok(1, "Loaded Endure properly");
+
+{
+#class Book does Endure::Resource {
+# has $.pages is Endure::property('string', {primary_key => 'a_key'});
+# has $.title is Endure::property(Str, {length => 3..10});
+#}
+
+#say 'done making books';
+
+#my $book = Book.new;
+#$book.pages.VAR.type.say;
+#$book.title.VAR.args.say;
+#$book.save;
+
+ class Book does Endure::Resource {
+ has Str $.title; # does Endure::property;
+ has Num $.length; # does Endure::property;
+ has Str $.author; # does Endure::property;
+ };
+
+ my Book $wild_things = Book.new(:title('Where the Wild Things Are'),
+ :length(48),
+ :author('Maurice Sendak'));
+
+ is($wild_things.title, 'Where the Wild Things Are', 'Attributes still function normally');
+}
View
2  t/constructors.t
@@ -1,2 +0,0 @@
-use v6;
-
Please sign in to comment.
Something went wrong with that request. Please try again.