Import unic-ucd-version 0.9.0 upstream upstream/0.9.0
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 4 May 2023 06:16:51 +0000 (15:16 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 4 May 2023 06:16:51 +0000 (15:16 +0900)
.cargo_vcs_info.json [new file with mode: 0644]
Cargo.toml [new file with mode: 0644]
Cargo.toml.orig [new file with mode: 0644]
src/lib.rs [new file with mode: 0644]
src/pkg_info.rs [new file with mode: 0644]
src/unicode_version.rs [new file with mode: 0644]
tables/unicode_version.rsv [new file with mode: 0644]
tests/basic_tests.rs [new file with mode: 0644]

diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
new file mode 100644 (file)
index 0000000..c44225f
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "git": {
+    "sha1": "5878605364af97a3358368a6eaef02104af2e016"
+  }
+}
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644 (file)
index 0000000..c632814
--- /dev/null
@@ -0,0 +1,42 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+edition = "2018"
+name = "unic-ucd-version"
+version = "0.9.0"
+authors = ["The UNIC Project Developers"]
+exclude = []
+description = "UNIC — Unicode Character Database — Version"
+keywords = ["text", "unicode", "version"]
+categories = ["internationalization", "text-processing", "parsing", "rendering"]
+license = "MIT/Apache-2.0"
+repository = "https://github.com/open-i18n/rust-unic/"
+[dependencies.unic-common]
+version = "0.9.0"
+[badges.appveyor]
+branch = "master"
+repository = "open-i18n/rust-unic"
+service = "github"
+
+[badges.is-it-maintained-issue-resolution]
+repository = "open-i18n/rust-unic"
+
+[badges.is-it-maintained-open-issues]
+repository = "open-i18n/rust-unic"
+
+[badges.maintenance]
+status = "actively-developed"
+
+[badges.travis-ci]
+branch = "master"
+repository = "open-i18n/rust-unic"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
new file mode 100644 (file)
index 0000000..a8dd931
--- /dev/null
@@ -0,0 +1,23 @@
+[package]
+name = "unic-ucd-version"
+version = "0.9.0"
+edition = "2018"
+authors = ["The UNIC Project Developers"]
+repository = "https://github.com/open-i18n/rust-unic/"
+license = "MIT/Apache-2.0"
+description = "UNIC — Unicode Character Database — Version"
+keywords = ["text", "unicode", "version"]
+categories = ["internationalization", "text-processing", "parsing", "rendering"]
+
+# No tests/benches that depends on /data/
+exclude = []
+
+[dependencies]
+unic-common = { path = "../../common/", version = "0.9.0" }
+
+[badges]
+maintenance = { status = "actively-developed" }
+is-it-maintained-issue-resolution = { repository = "open-i18n/rust-unic" }
+is-it-maintained-open-issues = { repository = "open-i18n/rust-unic" }
+appveyor = { repository = "open-i18n/rust-unic", branch = "master", service = "github" }
+travis-ci = { repository = "open-i18n/rust-unic", branch = "master" }
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644 (file)
index 0000000..3877f04
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright 2017 The UNIC Project Developers.
+//
+// See the COPYRIGHT file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![no_std]
+#![warn(
+    bad_style,
+    missing_debug_implementations,
+    missing_docs,
+    unconditional_recursion
+)]
+#![forbid(unsafe_code)]
+
+//! # UNIC — UCD — Core
+//!
+//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/).
+//!
+//! Core create indicating the version of Unicode Character Database.
+
+pub use unic_common::version::UnicodeVersion;
+
+mod pkg_info;
+pub use crate::pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};
+
+mod unicode_version;
+pub use crate::unicode_version::UNICODE_VERSION;
diff --git a/src/pkg_info.rs b/src/pkg_info.rs
new file mode 100644 (file)
index 0000000..a1ab285
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2017 The UNIC Project Developers.
+//
+// See the COPYRIGHT file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Package information
+
+/// UNIC component version.
+pub const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
+
+/// UNIC component name.
+pub const PKG_NAME: &str = env!("CARGO_PKG_NAME");
+
+/// UNIC component description.
+pub const PKG_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
diff --git a/src/unicode_version.rs b/src/unicode_version.rs
new file mode 100644 (file)
index 0000000..8e96e7f
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2017 The UNIC Project Developers.
+//
+// See the COPYRIGHT file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use unic_common::version::UnicodeVersion;
+
+/// The [Version of The Unicode Standard](https://www.unicode.org/versions/) of the Unicode
+/// Character Database in use.
+pub const UNICODE_VERSION: UnicodeVersion = include!("../tables/unicode_version.rsv");
+
+#[cfg(test)]
+mod tests {
+    use super::UNICODE_VERSION;
+
+    #[test]
+    fn validate_version_values() {
+        assert!(UNICODE_VERSION.major > 0);
+
+        // Current release schedule of Unicode is to have one Major version update each year, with
+        // no Minor updates. We hard-code this internal policy while it stands.
+        assert!(UNICODE_VERSION.minor == 0);
+    }
+}
diff --git a/tables/unicode_version.rsv b/tables/unicode_version.rsv
new file mode 100644 (file)
index 0000000..63d0ef1
--- /dev/null
@@ -0,0 +1,3 @@
+// WARNING: Auto-generated by the `unic-gen` crate.
+// WARNING: DO NOT EDIT MANUALLY!
+UnicodeVersion { major: 10, minor: 0, micro: 0 }
diff --git a/tests/basic_tests.rs b/tests/basic_tests.rs
new file mode 100644 (file)
index 0000000..e385bcf
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2017 The UNIC Project Developers.
+//
+// See the COPYRIGHT file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use unic_ucd_version::UnicodeVersion;
+
+#[test]
+fn test_display() {
+    assert_eq!(
+        format!(
+            "Unicode {}",
+            UnicodeVersion {
+                major: 1,
+                minor: 2,
+                micro: 0,
+            }
+        ),
+        "Unicode 1.2.0"
+    );
+}