Skip to content

Commit 3760a98

Browse files
committed
Check doc code blocks
1 parent a8cf28d commit 3760a98

3 files changed

Lines changed: 18 additions & 23 deletions

File tree

Makefile.in

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,6 @@ export RUSTFLAGS := -O --cfg ndebug
44
BUILDDIR := build
55
INSTALL_DIR := %PREFIX%
66

7-
###############################################################################
8-
# Reconfiguration
9-
###############################################################################
10-
CONFIGURE_ARGS := %CONFIGURE_ARGS%
11-
12-
NEED_GIT_RECONFIG := $(shell git submodule status | grep -c '^\(+|-\)')
13-
14-
ifeq ($(NEED_GIT_RECONFIG),0)
15-
else
16-
.PHONY: config.stamp
17-
endif
18-
19-
Makefile: config.stamp
20-
21-
config.stamp: configure Makefile.in
22-
./configure $(CONFIGURE_ARGS)
23-
247
###############################################################################
258
# Dependencies
269
###############################################################################
@@ -71,8 +54,10 @@ all: $(POSTGRES_LIB)
7154
###############################################################################
7255
# Utility
7356
###############################################################################
57+
check-doc: $(POSTGRES_LIB)
58+
$(RUSTDOC) $(LINK_ARGS) -L $(BUILDDIR) --test $(POSTGRES_LIB_FILE)
7459

75-
check: $(POSTGRES_TEST)
60+
check: $(POSTGRES_TEST) check-doc
7661
$(POSTGRES_TEST)
7762

7863
clean:
@@ -90,4 +75,4 @@ install: $(POSTGRES_LIB)
9075
$(MAKE) -C $(PHF_DIR) install INSTALL_DIR=$(abspath $(INSTALL_DIR))
9176
install $(POSTGRES_LIB) $(INSTALL_DIR)
9277

93-
.PHONY: check clean doc install
78+
.PHONY: check-doc check clean clean-deps doc install

src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ package.
55
66
```rust
77
extern crate postgres;
8-
extern crate extra;
8+
extern crate time;
99
10-
use extra::time;
11-
use extra::time::Timespec;
10+
use time::Timespec;
1211
1312
use postgres::{PostgresConnection, PostgresStatement, NoSsl};
1413
use postgres::types::ToSql;
@@ -20,6 +19,7 @@ struct Person {
2019
data: Option<~[u8]>
2120
}
2221
22+
# fn main() {
2323
fn main() {
2424
let conn = PostgresConnection::connect("postgres://postgres@localhost",
2525
&NoSsl);
@@ -52,6 +52,7 @@ fn main() {
5252
println!("Found person {}", person.name);
5353
}
5454
}
55+
# }
5556
```
5657
*/
5758

@@ -683,7 +684,7 @@ impl PostgresConnection {
683684
///
684685
/// The URL should be provided in the normal format:
685686
///
686-
/// ```
687+
/// ```notrust
687688
/// postgres://user[:password]@host[:port][/database][?param1=val1[[&param2=val2]...]]
688689
/// ```
689690
///

src/stmt.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,17 @@ impl<'stmt> Iterator<PostgresRow<'stmt>> for PostgresResult<'stmt> {
472472
/// by index is more efficient. Rows are 1-indexed.
473473
///
474474
/// ```rust
475+
/// # extern crate postgres;
476+
/// # use postgres::{PostgresConnection, PostgresStatement, NoSsl};
477+
/// # fn main() {}
478+
/// # fn foo() {
479+
/// # let conn = PostgresConnection::connect("", &NoSsl);
480+
/// # let stmt = conn.prepare("");
481+
/// # let mut result = stmt.query([]);
482+
/// # let row = result.next().unwrap();
475483
/// let foo: i32 = row[1];
476484
/// let bar: ~str = row["bar"];
485+
/// # }
477486
/// ```
478487
pub struct PostgresRow<'stmt> {
479488
priv stmt: &'stmt NormalPostgresStatement<'stmt>,

0 commit comments

Comments
 (0)