Skip to content

Commit

Permalink
update tests and docs, close #73
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniogamiz committed Aug 5, 2019
1 parent 87cb715 commit ec99e90
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 39 deletions.
22 changes: 9 additions & 13 deletions docs/reference/perl6-documentable-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ You can create one by typing:

```perl6
use Pod::Load;
use Perl6::TypeGraph;
use Perl6::Documentable::File;

my $tg = Perl6::TypeGraph.new-from-file;
my $pod = load("Type/int.pod6")[0];
my $doc = Perl6::Documentable::File.new(
dir => "Type", # used to determine the kind
filename => "int" , # Type/int.pod6 => int
tg => $tg , # to complete the information about Type pods
pod => $pod , # the pod
);
```
Expand All @@ -26,7 +22,15 @@ say $doc.defs.map({.name})
say $doc.refs.map({.name})
```

**Note:** `=TITLE` and `=SUBTITLE` elements must be present at the beginning of the file, otherwise, a `X::Documentable::TitleNotFound` or `X::Documentable::SubtitleNotFound` exception will be thrown.
**Note 1:** `=TITLE` and `=SUBTITLE` elements must be present at the beginning of the file, otherwise, a `X::Documentable::TitleNotFound` or `X::Documentable::SubtitleNotFound` exception will be thrown.

**Note 2:** Some additional config muts be present in the pod passed to to the constructor: The first line of the pod file should be something like:

```
=begin pod :kind("<value>") :subkind("<value>") :category("<value>")
```

These attributes are used to classify the pods. If any of these values is missing, a `X::Documentable::MissingMetadata` exception will be thrown.

### Attributes

Expand Down Expand Up @@ -118,15 +122,11 @@ Example:

```perl6
use Pod::Load;
use Perl6::TypeGraph;

my $pod = load("type/Any.pod6").first;
my $tg = Perl6::TypeGraph.new-from-file;

my $origin = Perl6::Documentable::File.new(
dir => "Type", # used to determine the kind
filename => "Any" , # Type/int.pod6 => int
tg => $tg , # to complete the information about Type pods
pod => $pod , # the pod
);

Expand All @@ -153,15 +153,11 @@ Example:

```perl6
use Pod::Load;
use Perl6::TypeGraph;

my $pod = load("type/Any.pod6").first;
my $tg = Perl6::TypeGraph.new-from-file;

my $origin = Perl6::Documentable::File.new(
dir => "Type", # used to determine the kind
filename => "Any" , # Type/int.pod6 => int
tg => $tg , # to complete the information about Type pods
pod => $pod , # the pod
);

Expand Down
7 changes: 0 additions & 7 deletions t/201-documentable-file.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use Perl6::Documentable;
use Perl6::Documentable::File;
use Perl6::TypeGraph;
use Pod::Load;
use Pod::Utilities;
use Pod::Utilities::Build;
Expand All @@ -9,12 +8,9 @@ use Test;
plan *;

my $pod = load("t/test-doc/Native/int.pod6")[0];
my $tg = Perl6::TypeGraph.new-from-file;

my $doc = Perl6::Documentable::File.new(
:dir("Type"),
:$pod,
:$tg,
:filename("int")
);

Expand Down Expand Up @@ -103,7 +99,6 @@ subtest "Index X<> heading" => {
=end pod


subtest '=TITLE =SUBTITLE compulsory' => {
test-exception($=pod[0], "=TITLE and =SUBTITLE");
test-exception($=pod[1], "=TITLE");
Expand Down Expand Up @@ -135,9 +130,7 @@ sub test-scope($name, $str) {

sub test-exception($pod, $msg) {
dies-ok { Perl6::Documentable::File.new(
:dir("Type"),
:$pod,
:$tg,
:filename("int")
)}, $msg;
}
Expand Down
4 changes: 0 additions & 4 deletions t/202-references.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ use Perl6::Documentable::Index;
use Pod::Load;
use Pod::Utilities;
use Pod::Utilities::Build;
use Perl6::TypeGraph;

use Test;

plan *;

my $pod = load("t/test-doc/Programs/02-reading-docs.pod6")[0];
my $tg = Perl6::TypeGraph.new-from-file;
my $origin = Perl6::Documentable::File.new(
dir => "Type",
pod => $pod,
tg => $tg,
filename => "test",
);

Expand Down
6 changes: 0 additions & 6 deletions t/302-process-pod-source.t
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
use Test;

use Perl6::Documentable::File;
use Perl6::TypeGraph;
use Pod::Load;

plan *;

my $pod = load("t/test-doc/Native/int.pod6").first;
my $tg = Perl6::TypeGraph.new-from-file;
my $doc1 = Perl6::Documentable::File.new(
dir => "Type",
pod => $pod,
filename => "int",
tg => $tg
);

# change the kind to test the setting of attributes like <name>
my $doc2 = Perl6::Documentable::File.new(
dir => "Language",
pod => load("t/test-doc/Language/operators.pod6")[0],
filename => "int",
tg => $tg
);

subtest "Basic attributes" => {
Expand Down
9 changes: 0 additions & 9 deletions t/303-process-pod-dir.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use Test;

use Perl6::Documentable::Registry;
use Perl6::TypeGraph;
use Pod::Load;

plan *;
Expand All @@ -12,13 +11,9 @@ my $registry = Perl6::Documentable::Registry.new(
:verbose(False)
);

my $tg = Perl6::TypeGraph.new-from-file;

my $expected = Perl6::Documentable::File.new(
dir => "Type",
pod => load("t/test-doc/Native/int.pod6")[0],
filename => "int",
tg => $tg
);

subtest "process pod dir" => {
Expand All @@ -43,16 +38,12 @@ subtest "multi-class support" => {
# expected documentables
my @pods = load("t/test-doc/Native/multi-class.pod6");
my $doc1 = Perl6::Documentable::File.new(
dir => "Native",
pod => @pods[0],
filename => "multi-class",
tg => $tg
);
my $doc2 = Perl6::Documentable::File.new(
dir => "Native",
pod => @pods[1],
filename => "multi-class",
tg => $tg
);

is-deeply @docs, [$doc1, $doc2], "multi-class file declaration";
Expand Down

0 comments on commit ec99e90

Please sign in to comment.