Skip to content

Commit 3236a92

Browse files
committed
add(zone.rs): Added some comments of how the fn from_master_file works and how to test it.
1 parent be5028d commit 3236a92

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/zones.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ impl DnsZone {
153153
/// assert!(!dns_zone.ns_records.is_empty());
154154
/// assert!(!dns_zone.resource_records.is_empty());
155155
/// ```
156+
/// Disclaimer!!
157+
/// The SOA must be all in only one line
158+
/// Example:
159+
/// EDU. IN SOA SRI-NIC.ARPA. HOSTMASTER.SRI-NIC.ARPA. ( 870729 1800 300 604800 86400 )
160+
/// . IN SOA SRI-NIC.ARPA. HOSTMASTER.SRI-NIC.ARPA. ( 870611 1800 300 604800 86400 )
156161
pub fn from_master_file(file_path: &str) -> io::Result<Self> { // Result<Self, io::Error> is the same as io::Result<Self>
157162
// Open the file
158163
let path = Path::new(file_path);
@@ -460,6 +465,13 @@ mod dns_zone_tests {
460465
assert_eq!(dns_zone.get_resource_records()[0].get_rdata(), Rdata::TXT(TxtRdata::new(vec![String::from("dcc")])));
461466
}
462467

468+
469+
/// Disclaimer!!
470+
/// The SOA must be all in only one line
471+
/// The file used in the next text does not have the SOA in one line
472+
/// Change the file to test the function
473+
/// New SOA:
474+
/// EDU. IN SOA SRI-NIC.ARPA. HOSTMASTER.SRI-NIC.ARPA. ( 870729 1800 300 604800 86400 )
463475
#[test]
464476
fn test_from_master_file_edu() {
465477
// Master file for the EDU domain.
@@ -493,6 +505,13 @@ mod dns_zone_tests {
493505
//assert!(dns_zone.get_resource_records().iter().any(|rr| rr.get_name().get_name() == "YALE.EDU." && matches!(rr.get_rdata(), Rdata::NS(_))));
494506
}
495507

508+
509+
/// Disclaimer!!
510+
/// The SOA must be all in only one line
511+
/// The file used in the next text does not have the SOA in one line
512+
/// Change the file to test the function
513+
/// New SOA:
514+
/// . IN SOA SRI-NIC.ARPA. HOSTMASTER.SRI-NIC.ARPA. ( 870611 1800 300 604800 86400 )
496515
#[test]
497516
fn test_from_master_file_root() {
498517
// Master file for the root zone.

0 commit comments

Comments
 (0)