Bump bytecount to 0.6

Bump pulldown-cmark to 0.6

Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
epel9
Robert-André Mauchin 5 years ago
parent d276d5c896
commit f0371380b2

@ -1,29 +0,0 @@
From fa0c0491ed29d8b8006e9ebfc0c8dae0f3be285f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Thu, 1 Aug 2019 00:18:55 +0200
Subject: [PATCH] Bump pulldown-cmark to 0.5
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
---
src/skeptic/lib.rs | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib.rs b/lib.rs
index 08c0066..b9a4eb7 100644
--- a/lib.rs
+++ b/lib.rs
@@ -231,7 +231,7 @@ fn extract_tests_from_string(s: &str, file_stem: &str) -> (Vec<Test>, Option<Str
if buf.is_empty() {
code_block_start = line_number;
}
- buf.push(text.into_owned());
+ buf.extend(text.lines().map(|s| format!("{}\n", s)));
} else if let Buffer::Header(ref mut buf) = buffer {
buf.push_str(&*text);
}
--
2.21.0

@ -0,0 +1,72 @@
From 22423be7b62af427d062f09068c7a42af35b1fb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Thu, 1 Aug 2019 00:18:55 +0200
Subject: [PATCH] Bump pulldown-cmark to 0.6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
---
lib.rs | 28 ++++++++++------------------
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/lib.rs b/lib.rs
index 08c0066..c6d23f8 100644
--- a/lib.rs
+++ b/lib.rs
@@ -169,7 +169,7 @@ fn extract_tests(config: &Config) -> Result<DocTestSuite, IoError> {
enum Buffer {
None,
Code(Vec<String>),
- Header(String),
+ Heading(String),
}
fn extract_tests_from_file(path: &Path) -> Result<DocTest, IoError> {
@@ -199,24 +199,16 @@ fn extract_tests_from_string(s: &str, file_stem: &str) -> (Vec<Test>, Option<Str
let mut code_block_start = 0;
// Oh this isn't actually a test but a legacy template
let mut old_template = None;
-
- // In order to call get_offset() on the parser,
- // this loop must not hold an exclusive reference to the parser.
- loop {
- let offset = parser.get_offset();
- let line_number = bytecount::count(&s.as_bytes()[0..offset], b'\n');
- let event = if let Some(event) = parser.next() {
- event
- } else {
- break;
- };
+
+ for (event, range) in parser.into_offset_iter() {
+ let line_number = bytecount::count(&s.as_bytes()[0..range.start], b'\n');
match event {
- Event::Start(Tag::Header(level)) if level < 3 => {
- buffer = Buffer::Header(String::new());
+ Event::Start(Tag::Heading(level)) if level < 3 => {
+ buffer = Buffer::Heading(String::new());
}
- Event::End(Tag::Header(level)) if level < 3 => {
+ Event::End(Tag::Heading(level)) if level < 3 => {
let cur_buffer = mem::replace(&mut buffer, Buffer::None);
- if let Buffer::Header(sect) = cur_buffer {
+ if let Buffer::Heading(sect) = cur_buffer {
section = Some(sanitize_test_name(&sect));
}
}
@@ -231,8 +223,8 @@ fn extract_tests_from_string(s: &str, file_stem: &str) -> (Vec<Test>, Option<Str
if buf.is_empty() {
code_block_start = line_number;
}
- buf.push(text.into_owned());
- } else if let Buffer::Header(ref mut buf) = buffer {
+ buf.extend(text.lines().map(|s| format!("{}\n", s)));
+ } else if let Buffer::Heading(ref mut buf) = buffer {
buf.push_str(&*text);
}
}
--
2.21.0

@ -1,4 +1,5 @@
# Generated by rust2rpm 10
# Needs test files not provided in the crate
%bcond_with check
%global debug_package %{nil}
@ -6,23 +7,22 @@
Name: rust-%{crate}
Version: 0.13.4
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Test your Rust markdown documentation via Cargo
# Upstream license specification: MIT/Apache-2.0
# https://github.com/budziq/rust-skeptic/issues/96
License: MIT or ASL 2.0
URL: https://crates.io/crates/skeptic
Source: %{crates_source}
# Initial patched metadata
# * Update bytecount to 0.5 (upstreamed)
# * Update cargo_metadata to 0.8 https://github.com/budziq/rust-skeptic/pull/107
# * Update glob to 0.3 (upstreamed)
# * Update pulldown-cmark to 0.5 https://github.com/budziq/rust-skeptic/pull/108
# - Bump bytecount to 0.6 https://github.com/budziq/rust-skeptic/pull/109
# - Bump cargo_metadata to 0.8 https://github.com/budziq/rust-skeptic/pull/107
# - Bump glob to 0.3 (upstreamed)
# - Bump pulldown-cmark to 0.6 https://github.com/budziq/rust-skeptic/pull/108
Patch0: skeptic-fix-metadata.diff
Patch1: 0001-Bumped-glob-and-cargo_metadata-to-latest-version.patch
Patch2: 0001-Bump-cargo_metadata-to-0.8.patch
Patch3: 0001-Bump-pulldown-cmark-to-0.5.patch
Patch3: 0001-Bump-pulldown-cmark-to-0.6.patch
ExclusiveArch: %{rust_arches}
%if %{__cargo_skip_build}
@ -80,6 +80,10 @@ which use "default" feature of "%{crate}" crate.
%endif
%changelog
* Fri Sep 13 17:49:45 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.13.4-5
- Bump bytecount to 0.6
- Bump pulldown-cmark to 0.6
* Thu Aug 01 00:51:23 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.13.4-4
- Update 0001-Bump-cargo_metadata-to-0.8 patch

@ -1,11 +1,11 @@
--- skeptic-0.13.4/Cargo.toml 1970-01-01T00:00:00+00:00
+++ skeptic-0.13.4/Cargo.toml 2019-07-31T22:15:46.080294+00:00
+++ skeptic-0.13.4/Cargo.toml 2019-09-13T15:49:45.807251+00:00
@@ -27,20 +27,20 @@
name = "skeptic"
path = "lib.rs"
[dependencies.bytecount]
-version = "0.4"
+version = "0.5"
+version = "0.6"
[dependencies.cargo_metadata]
-version = "0.6"
@ -21,7 +21,7 @@
[dependencies.pulldown-cmark]
-version = "0.2"
+version = "0.5"
+version = "0.6"
default-features = false
[dependencies.serde_json]

Loading…
Cancel
Save