Add tests for namespace sorter.
diff --git a/syntax/namespace.rs b/syntax/namespace.rs
index b4c6716..5eb203a 100644
--- a/syntax/namespace.rs
+++ b/syntax/namespace.rs
@@ -1,4 +1,6 @@
use crate::syntax::qualified::QualifiedName;
+#[cfg(test)]
+use proc_macro2::Span;
use quote::IdentFragment;
use std::fmt::{self, Display};
use std::slice::Iter;
@@ -36,6 +38,16 @@
input.parse::<Option<Token![,]>>()?;
Ok(ns)
}
+
+ #[cfg(test)]
+ pub fn from_str(ns: &str) -> Self {
+ Namespace {
+ segments: ns
+ .split("::")
+ .map(|x| Ident::new(x, Span::call_site()))
+ .collect(),
+ }
+ }
}
impl Parse for Namespace {