Permalink
Browse files

first squirrel test

...and the stubbed Squirrel.pm to make it fail.
  • Loading branch information...
masak committed Sep 8, 2009
1 parent bf85e0a commit e11fd096bb53a10f39b94ee970e388b638c96b23
Showing with 42 additions and 0 deletions.
  1. +21 −0 lib/Squirrel.pm
  2. +21 −0 t/squirrel/sqlite-write.t
View
@@ -0,0 +1,21 @@
+class Squirrel::Dataset {
+ method insert(*@values) {
+ }
+}
+
+class Squirrel::Database {
+ has $.file;
+
+ method create_table(*@args) {
+ }
+
+ method from($table) {
+ return Squirrel::Dataset.new();
+ }
+}
+
+class Squirrel {
+ method sqlite($file) {
+ return Squirrel::Database.new(:$file);
+ }
+}
View
@@ -0,0 +1,21 @@
+use v6;
+use Test;
+
+use Squirrel;
+
+unlink (my $file = 't/squirrel/posts.db');
+my $DB = Squirrel.sqlite($file);
+
+$DB.create_table: <posts
+ primary_key id
+ Int user_id
+ String name
+>;
+
+#my $posts = $DB<posts>;
+my $posts = $DB.from('posts');
+
+$posts.insert(1, 'Hello Austria!');
+
+ok $file ~~ :e, 'could create the database file';
+unlink $file;

0 comments on commit e11fd09

Please sign in to comment.