From 482be29e0f03e10c2469ef80bdd6ac7593207dc5 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 6 Aug 2019 20:38:06 +0200 Subject: RFC3986 URLs --- dhall/build.rs | 20 ++++++++++++++++++-- dhall/src/phase/binary.rs | 8 +++++++- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'dhall') diff --git a/dhall/build.rs b/dhall/build.rs index 7e320c5..cdbd560 100644 --- a/dhall/build.rs +++ b/dhall/build.rs @@ -94,6 +94,12 @@ fn main() -> std::io::Result<()> { || path == "success/recordProjectionByExpression" || path == "success/unit/recordProjectionByExpression" || path == "success/unit/recordProjectionByExpressionEmpty" + // TODO: RFC3986 URLs + || path == "success/unit/import/urls/emptyPath0" + || path == "success/unit/import/urls/emptyPath1" + || path == "success/unit/import/urls/emptyPathSegment" + // Test is broken + || path == "success/unit/import/asLocation" }, )?; @@ -113,6 +119,12 @@ fn main() -> std::io::Result<()> { || path == "success/recordProjectionByExpression" || path == "success/unit/recordProjectionByExpression" || path == "success/unit/recordProjectionByExpressionEmpty" + // TODO: RFC3986 URLs + || path == "success/unit/import/urls/emptyPath0" + || path == "success/unit/import/urls/emptyPath1" + || path == "success/unit/import/urls/emptyPathSegment" + // Test is broken + || path == "success/unit/import/asLocation" }, )?; @@ -137,6 +149,12 @@ fn main() -> std::io::Result<()> { || path == "success/recordProjectionByExpression" || path == "success/unit/recordProjectionByExpression" || path == "success/unit/recordProjectionByExpressionEmpty" + // TODO: RFC3986 URLs + || path == "success/unit/import/urls/emptyPath0" + || path == "success/unit/import/urls/emptyPath1" + || path == "success/unit/import/urls/emptyPathSegment" + // Test is broken + || path == "success/unit/import/asLocation" }, )?; @@ -156,8 +174,6 @@ fn main() -> std::io::Result<()> { || path == "success/unit/RecordProjectionTypeNormalizeProjection" // TODO: fix Double/show || path == "success/prelude/JSON/number/1" - // the test is wrong - || path == "success/prelude/JSON/Type/0" }, )?; diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs index 443af7e..bab3fd8 100644 --- a/dhall/src/phase/binary.rs +++ b/dhall/src/phase/binary.rs @@ -195,8 +195,13 @@ fn cbor_value_to_dhall( } [U64(24), hash, U64(mode), U64(scheme), rest..] => { let mode = match mode { + 0 => ImportMode::Code, 1 => ImportMode::RawText, - _ => ImportMode::Code, + 2 => ImportMode::Location, + _ => Err(DecodeError::WrongFormatError(format!( + "import/mode/unknown_mode: {:?}", + mode + )))?, }; let hash = match hash { Null => None, @@ -545,6 +550,7 @@ where let mode = match import.mode { ImportMode::Code => 0, ImportMode::RawText => 1, + ImportMode::Location => 2, }; ser_seq.serialize_element(&U64(mode))?; -- cgit v1.2.3