瀏覽代碼

Remove doctests for code that gets tested anyway

Since writing dog, I've started moving away from including doctests for libraries that just get called by their binaries anyway. It's not testing any code that doesn't get checked by the compiler and the integration tests, and it makes the build take longer.
Benjamin Sago 4 年之前
父節點
當前提交
30e9d3d2e8
共有 6 個文件被更改,包括 7 次插入117 次删除
  1. 3 3
      Justfile
  2. 1 24
      dns-transport/src/auto.rs
  3. 0 23
      dns-transport/src/https.rs
  4. 0 23
      dns-transport/src/tcp.rs
  5. 0 23
      dns-transport/src/tls.rs
  6. 3 21
      dns-transport/src/udp.rs

+ 3 - 3
Justfile

@@ -34,15 +34,15 @@ export DOG_DEBUG := ""
 
 # run unit tests
 @test:
-    cargo test --workspace -- --quiet
+    cargo test --lib --bin dog --workspace -- --quiet
 
 # run unit tests (in release mode)
 @test-release:
-    cargo test --release --workspace --verbose
+    cargo test --lib --bin dog -workspace --release --verbose
 
 # run unit tests (without some features)
 @test-quick:
-    cargo test --workspace --no-default-features -- --quiet
+    cargo test --lib --bin dog --workspace --no-default-features -- --quiet
 
 # run mutation tests
 @test-mutation:

+ 1 - 24
dns-transport/src/auto.rs

@@ -6,32 +6,9 @@ use super::{Transport, Error, UdpTransport, TcpTransport};
 
 /// The **automatic transport**, which sends DNS wire data using the UDP
 /// transport, then tries using the TCP transport if the first one fails
-/// because the response wouldn't fit in a single UDP packet.
+/// because the response wouldnt fit in a single UDP packet.
 ///
 /// This is the default behaviour for many DNS clients.
-///
-/// # Examples
-///
-/// ```no_run
-/// use dns_transport::{Transport, AutoTransport};
-/// use dns::{Request, Flags, Query, Labels, QClass, qtype, record::NS};
-///
-/// let query = Query {
-///     qname: Labels::encode("dns.lookup.dog").unwrap(),
-///     qclass: QClass::IN,
-///     qtype: qtype!(NS),
-/// };
-///
-/// let request = Request {
-///     transaction_id: 0xABCD,
-///     flags: Flags::query(),
-///     query: query,
-///     additional: None,
-/// };
-///
-/// let transport = AutoTransport::new("8.8.8.8");
-/// transport.send(&request);
-/// ```
 pub struct AutoTransport {
     addr: String,
 }

+ 0 - 23
dns-transport/src/https.rs

@@ -11,29 +11,6 @@ use super::{Transport, Error};
 
 /// The **HTTPS transport**, which sends DNS wire data inside HTTP packets
 /// encrypted with TLS, using TCP.
-///
-/// # Examples
-///
-/// ```no_run
-/// use dns_transport::{Transport, HttpsTransport};
-/// use dns::{Request, Flags, Query, Labels, QClass, qtype, record::A};
-///
-/// let query = Query {
-///     qname: Labels::encode("dns.lookup.dog").unwrap(),
-///     qclass: QClass::IN,
-///     qtype: qtype!(A),
-/// };
-///
-/// let request = Request {
-///     transaction_id: 0xABCD,
-///     flags: Flags::query(),
-///     query: query,
-///     additional: None,
-/// };
-///
-/// let transport = HttpsTransport::new("https://cloudflare-dns.com/dns-query");
-/// transport.send(&request);
-/// ```
 pub struct HttpsTransport {
     url: String,
 }

+ 0 - 23
dns-transport/src/tcp.rs

@@ -10,29 +10,6 @@ use super::{Transport, Error};
 
 /// The **TCP transport**, which sends DNS wire data over a TCP stream.
 ///
-/// # Examples
-///
-/// ```no_run
-/// use dns_transport::{Transport, TcpTransport};
-/// use dns::{Request, Flags, Query, Labels, QClass, qtype, record::MX};
-///
-/// let query = Query {
-///     qname: Labels::encode("dns.lookup.dog").unwrap(),
-///     qclass: QClass::IN,
-///     qtype: qtype!(MX),
-/// };
-///
-/// let request = Request {
-///     transaction_id: 0xABCD,
-///     flags: Flags::query(),
-///     query: query,
-///     additional: None,
-/// };
-///
-/// let transport = TcpTransport::new("8.8.8.8");
-/// transport.send(&request);
-/// ```
-///
 /// # References
 ///
 /// - [RFC 1035 §4.2.2](https://tools.ietf.org/html/rfc1035) — Domain Names,

+ 0 - 23
dns-transport/src/tls.rs

@@ -11,29 +11,6 @@ use super::{Transport, Error, TcpTransport};
 
 /// The **TLS transport**, which sends DNS wire data using TCP through an
 /// encrypted TLS connection.
-///
-/// # Examples
-///
-/// ```no_run
-/// use dns_transport::{Transport, TlsTransport};
-/// use dns::{Request, Flags, Query, Labels, QClass, qtype, record::SRV};
-///
-/// let query = Query {
-///     qname: Labels::encode("dns.lookup.dog").unwrap(),
-///     qclass: QClass::IN,
-///     qtype: qtype!(SRV),
-/// };
-///
-/// let request = Request {
-///     transaction_id: 0xABCD,
-///     flags: Flags::query(),
-///     query: query,
-///     additional: None,
-/// };
-///
-/// let transport = TlsTransport::new("dns.google");
-/// transport.send(&request);
-/// ```
 pub struct TlsTransport {
     addr: String,
 }

+ 3 - 21
dns-transport/src/udp.rs

@@ -8,28 +8,10 @@ use super::{Transport, Error};
 
 /// The **UDP transport**, which sends DNS wire data inside a UDP datagram.
 ///
-/// # Examples
+/// # References
 ///
-/// ```no_run
-/// use dns_transport::{Transport, UdpTransport};
-/// use dns::{Request, Flags, Query, Labels, QClass, qtype, record::NS};
-///
-/// let query = Query {
-///     qname: Labels::encode("dns.lookup.dog").unwrap(),
-///     qclass: QClass::IN,
-///     qtype: qtype!(NS),
-/// };
-///
-/// let request = Request {
-///     transaction_id: 0xABCD,
-///     flags: Flags::query(),
-///     query: query,
-///     additional: None,
-/// };
-///
-/// let transport = UdpTransport::new("8.8.8.8");
-/// transport.send(&request);
-/// ```
+/// - [RFC 1035 §4.2.1](https://tools.ietf.org/html/rfc1035) — Domain Names,
+///   Implementation and Specification (November 1987)
 pub struct UdpTransport {
     addr: String,
 }