Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some tests for PACT.Packfile

  • Loading branch information...
commit e062fa1413a8cb864f6906a4cd214e26edec6382 1 parent 8d3d4f8
@Benabik Benabik authored
Showing with 44 additions and 0 deletions.
  1. +44 −0 t/01-packfile/01-packfile.t
View
44 t/01-packfile/01-packfile.t
@@ -0,0 +1,44 @@
+#!winxed
+
+// Tests for PACT.Packfile
+
+$include 't/common.winxed';
+
+function main[main]() {
+ Rosella.Test.test(class PackfileTest);
+}
+
+class PackfileTest {
+ // Test that new Packfile has an empty UUID
+ function test_uuid_new() {
+ var assert = self.assert;
+ :PACT.Packfile pf();
+ assert.equal(0, pf.uuid_type);
+ assert.equal('', pf.uuid);
+ }
+
+ // Test setting an empty UUID
+ function test_uuid_set_empty() {
+ var assert = self.assert;
+ :PACT.Packfile pf();
+ assert.throws_nothing(function () {
+ pf.set_uuid(0, '');
+ });
+ assert.equal(0, pf.uuid_type);
+ assert.equal('', pf.uuid);
+ }
+
+ // Test setting an MD5 UUID
+ function test_uuid_set_md5() {
+ var assert = self.assert;
+ string md5 = 'd41d8cd98f00b204e9800998ecf8427e'; // Empty file
+ :PACT.Packfile pf();
+ assert.throws_nothing(function () {
+ pf.set_uuid(1, md5);
+ });
+ assert.equal(1, pf.uuid_type);
+ assert.equal(md5, pf.uuid);
+ }
+}
+
+# vim: ft=winxed
Please sign in to comment.
Something went wrong with that request. Please try again.