1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright notice and licensing information.
// These lines indicate the copyright of the software and its licensing terms.
// SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses.
// Copyright © 2023-2024 LibMake. All rights reserved.
//! # Test: Retrieving a CSV Field
//!
//! This is a test that demonstrates how to retrieve a specific field from a CSV file
//! using the `get_csv_field` function from the `libmake` crate.
//!
//! ## Purpose
//!
//! The purpose of this test is to show how to extract a CSV field at a specified index
//! from a CSV file located at the specified path (`file_path`).
//!
//! ## Usage
//!
//! To run this test, ensure that you have a valid CSV file at the specified path.
//! The test uses the `get_csv_field` function to retrieve the field at the specified index (0).
//! It then prints the result.
//!
//! ```rust
//! // Import the necessary function for retrieving a field from a CSV file.
//! use libmake::utils::get_csv_field;
//!
//! // Specify the path to the CSV file.
//! let file_path = "../tests/data/mylibrary.csv";
//!
//! // Retrieve the CSV field at index 0 and print the result.
//! println!(
//! "🦀 get_csv_field, ✅ {:?}",
//! get_csv_field(Some(file_path), 0)
//! );
//! ```
// Title: Test: Retrieving a CSV Field
use get_csv_field;
/// Retrieve CSV field
///
/// # Arguments
///
/// * `file_path` - Path to CSV file
/// * `index` - Index of field to retrieve
///
/// # Returns
///
/// String containing the requested field
///
pub