Clap: enable tests

Delete unnecessary dev-depencency.

Test: atest
x86_64 clap_test_src_lib: Passed: 87, Failed: 0, Ignored: 0, Assumption Failed: 0,

Change-Id: Ie72bc80e587746e5448741f364c4205d03429077
diff --git a/Android.bp b/Android.bp
index 488af76..c190885 100644
--- a/Android.bp
+++ b/Android.bp
@@ -31,6 +31,28 @@
     ],
 }
 
+rust_test {
+    name: "clap_test_src_lib",
+    // has rustc warnings
+    host_supported: true,
+    crate_name: "clap",
+    cargo_env_compat: true,
+    cargo_pkg_version: "2.33.3",
+    srcs: ["src/lib.rs"],
+    test_suites: ["general-tests"],
+    auto_gen_config: true,
+    test_options: {
+        unit_test: true,
+    },
+    edition: "2015",
+    rustlibs: [
+        "libbitflags",
+        "liblazy_static",
+        "libregex",
+        "libtextwrap",
+    ],
+}
+
 rust_library {
     name: "libclap",
     // has rustc warnings
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 3131a43..5c3e261 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -34,6 +34,9 @@
       "name": "authfs_device_test_src_lib"
     },
     {
+      "name": "clap_test_src_lib"
+    },
+    {
       "name": "diced_test"
     },
     {
@@ -72,6 +75,9 @@
       "name": "authfs_device_test_src_lib"
     },
     {
+      "name": "clap_test_src_lib"
+    },
+    {
       "name": "diced_test"
     },
     {
@@ -110,6 +116,9 @@
       "name": "authfs_device_test_src_lib"
     },
     {
+      "name": "clap_test_src_lib"
+    },
+    {
       "name": "diced_test"
     },
     {
diff --git a/cargo2android.json b/cargo2android.json
index a78ac00..3424d16 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -6,6 +6,8 @@
   ],
   "dependencies": true,
   "device": true,
+  "patch": "patches/Android.bp.patch",
   "features": "",
-  "run": true
-}
\ No newline at end of file
+  "run": true,
+  "tests": true
+}
diff --git a/patches/Android.bp.patch b/patches/Android.bp.patch
new file mode 100644
index 0000000..56b45f9
--- /dev/null
+++ b/patches/Android.bp.patch
@@ -0,0 +1,12 @@
+diff --git a/Android.bp b/Android.bp
+index a4414a9..c190885 100644
+--- a/Android.bp
++++ b/Android.bp
+@@ -50,7 +50,6 @@ rust_test {
+         "liblazy_static",
+         "libregex",
+         "libtextwrap",
+-        "libversion_sync",
+     ],
+ }
+ 
diff --git a/patches/export-Indices.patch b/patches/export-Indices.patch
deleted file mode 100644
index 0b1b8a6..0000000
--- a/patches/export-Indices.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From d5f0de17a2fa86f54ac472e8a6db701bbecff5ee Mon Sep 17 00:00:00 2001
-From: Andrew Scull <ascull@google.com>
-Date: Wed, 25 May 2022 12:46:19 +0000
-Subject: [PATCH] Export Indices type
-
-The Indices type is used in the public API of the library but the type
-itself isn't exported. Fix that while we wait for AOSP to upgrade to the
-newest version of the library which has already sorted this problem.
-
-Bug: 229854484
-Test: build
-Change-Id: I58d14fdcb8306feeb87aff8aa9bdac425e89c9b2
----
- src/args/mod.rs | 2 +-
- src/lib.rs      | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/args/mod.rs b/src/args/mod.rs
-index 8f076ea..a30f357 100644
---- a/src/args/mod.rs
-+++ b/src/args/mod.rs
-@@ -2,7 +2,7 @@ pub use self::any_arg::{AnyArg, DispOrder};
- pub use self::arg::Arg;
- pub use self::arg_builder::{Base, FlagBuilder, OptBuilder, PosBuilder, Switched, Valued};
- pub use self::arg_matcher::ArgMatcher;
--pub use self::arg_matches::{ArgMatches, OsValues, Values};
-+pub use self::arg_matches::{ArgMatches, Indices, OsValues, Values};
- pub use self::group::ArgGroup;
- pub use self::matched_arg::MatchedArg;
- pub use self::settings::{ArgFlags, ArgSettings};
-diff --git a/src/lib.rs b/src/lib.rs
-index 7dbb0f0..876acb0 100644
---- a/src/lib.rs
-+++ b/src/lib.rs
-@@ -558,7 +558,7 @@ extern crate vec_map;
- extern crate yaml_rust;
- 
- pub use app::{App, AppSettings};
--pub use args::{Arg, ArgGroup, ArgMatches, ArgSettings, OsValues, SubCommand, Values};
-+pub use args::{Arg, ArgGroup, ArgMatches, ArgSettings, Indices, OsValues, SubCommand, Values};
- pub use completions::Shell;
- pub use errors::{Error, ErrorKind, Result};
- pub use fmt::Format;
--- 
-2.36.1.124.g0e6072fb45-goog
-