From 3760a985287127b5c4b2a5c92f2aa9e7549081ba Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 8 Mar 2014 22:01:24 -0800 Subject: [PATCH] Check doc code blocks --- Makefile.in | 23 ++++------------------- src/lib.rs | 9 +++++---- src/stmt.rs | 9 +++++++++ 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6a5bb3b7..52f84db7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,23 +4,6 @@ export RUSTFLAGS := -O --cfg ndebug BUILDDIR := build INSTALL_DIR := %PREFIX% -############################################################################### -# Reconfiguration -############################################################################### -CONFIGURE_ARGS := %CONFIGURE_ARGS% - -NEED_GIT_RECONFIG := $(shell git submodule status | grep -c '^\(+|-\)') - -ifeq ($(NEED_GIT_RECONFIG),0) -else -.PHONY: config.stamp -endif - -Makefile: config.stamp - -config.stamp: configure Makefile.in - ./configure $(CONFIGURE_ARGS) - ############################################################################### # Dependencies ############################################################################### @@ -71,8 +54,10 @@ all: $(POSTGRES_LIB) ############################################################################### # Utility ############################################################################### +check-doc: $(POSTGRES_LIB) + $(RUSTDOC) $(LINK_ARGS) -L $(BUILDDIR) --test $(POSTGRES_LIB_FILE) -check: $(POSTGRES_TEST) +check: $(POSTGRES_TEST) check-doc $(POSTGRES_TEST) clean: @@ -90,4 +75,4 @@ install: $(POSTGRES_LIB) $(MAKE) -C $(PHF_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR)) install $(POSTGRES_LIB) $(INSTALL_DIR) -.PHONY: check clean doc install +.PHONY: check-doc check clean clean-deps doc install diff --git a/src/lib.rs b/src/lib.rs index 579d00f4..149bcc3e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,10 +5,9 @@ package. ```rust extern crate postgres; -extern crate extra; +extern crate time; -use extra::time; -use extra::time::Timespec; +use time::Timespec; use postgres::{PostgresConnection, PostgresStatement, NoSsl}; use postgres::types::ToSql; @@ -20,6 +19,7 @@ struct Person { data: Option<~[u8]> } +# fn main() { fn main() { let conn = PostgresConnection::connect("postgres://postgres@localhost", &NoSsl); @@ -52,6 +52,7 @@ fn main() { println!("Found person {}", person.name); } } +# } ``` */ @@ -683,7 +684,7 @@ impl PostgresConnection { /// /// The URL should be provided in the normal format: /// - /// ``` + /// ```notrust /// postgres://user[:password]@host[:port][/database][?param1=val1[[¶m2=val2]...]] /// ``` /// diff --git a/src/stmt.rs b/src/stmt.rs index 02cde9ae..377d7829 100644 --- a/src/stmt.rs +++ b/src/stmt.rs @@ -472,8 +472,17 @@ impl<'stmt> Iterator> for PostgresResult<'stmt> { /// by index is more efficient. Rows are 1-indexed. /// /// ```rust +/// # extern crate postgres; +/// # use postgres::{PostgresConnection, PostgresStatement, NoSsl}; +/// # fn main() {} +/// # fn foo() { +/// # let conn = PostgresConnection::connect("", &NoSsl); +/// # let stmt = conn.prepare(""); +/// # let mut result = stmt.query([]); +/// # let row = result.next().unwrap(); /// let foo: i32 = row[1]; /// let bar: ~str = row["bar"]; +/// # } /// ``` pub struct PostgresRow<'stmt> { priv stmt: &'stmt NormalPostgresStatement<'stmt>,