Skip to content

Commit

Permalink
import test failing because header parsing not yet implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Nov 12, 2024
1 parent 22ae86a commit 5da28f8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
1 change: 0 additions & 1 deletion v0.5/fastn-section/src/parser/header_value.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[allow(dead_code)]
pub fn header_value(
scanner: &mut fastn_section::Scanner<fastn_section::Document>,
) -> Option<fastn_section::HeaderValue> {
Expand Down
3 changes: 2 additions & 1 deletion v0.5/fastn-section/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ impl fastn_section::Section {
source: &'input str,
name: &str,
) -> Option<&'input str> {
dbg!(self);
self.headers
.iter()
.find(|h| h.name(source) == name)
.find(|h| dbg!(h.name(source)) == dbg!(name))
.and_then(|h| h.value.as_plain_string(source))
}
}
Expand Down
5 changes: 4 additions & 1 deletion v0.5/fastn-unresolved/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ impl fastn_section::JDebug for fastn_unresolved::Import {
.into(),
);

dbg!(&self);

if let Some(ref v) = self.export {
o.insert("exports".into(), v.debug(source));
o.insert("export".into(), v.debug(source));
}

if let Some(ref v) = self.exposing {
o.insert("exposing".into(), v.debug(source));
}

serde_json::Value::Object(o)
}
}
Expand Down
3 changes: 2 additions & 1 deletion v0.5/fastn-unresolved/src/parser/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn parse_field(
) -> Option<fastn_unresolved::Export> {
let header = match section.header_as_plain_string(field, source) {
Some(v) => v,
None => return None,
None => return dbg!(None),
};

Some(fastn_unresolved::Export::Things(
Expand All @@ -110,6 +110,7 @@ fn aliasable(s: &str) -> fastn_unresolved::AliasableIdentifier {
mod tests {
#[track_caller]
fn t1(source: &str, expected: serde_json::Value) {
println!("--------- testing -----------\n{source}\n--------- source ------------");
use fastn_section::JDebug;

let (mut document, sections) =
Expand Down
8 changes: 5 additions & 3 deletions v0.5/fastn-unresolved/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ impl From<&str> for fastn_unresolved::Identifier {
}
}

impl fastn_unresolved::Identifier {
pub fn from_str(s: &str) -> fastn_unresolved::Identifier {
fastn_unresolved::Identifier(s.to_string())
impl std::str::FromStr for fastn_unresolved::Identifier {
type Err = ();

fn from_str(s: &str) -> Result<fastn_unresolved::Identifier, ()> {
Ok(fastn_unresolved::Identifier(s.to_string()))
}
}

0 comments on commit 5da28f8

Please sign in to comment.