forked from TraceMachina/nativelink
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperation_id_tests.rs
More file actions
43 lines (39 loc) · 1.45 KB
/
operation_id_tests.rs
File metadata and controls
43 lines (39 loc) · 1.45 KB
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
// Copyright 2024 The Native Link Authors. All rights reserved.
//
// Licensed under the Functional Source License, Version 1.1, Apache 2.0 Future License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// See LICENSE file for details
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use nativelink_error::Error;
use nativelink_macro::nativelink_test;
use nativelink_util::action_messages::OperationId;
use pretty_assertions::assert_eq;
use uuid::Uuid;
#[nativelink_test]
async fn parse_operation_id() -> Result<(), Error> {
let operation_id = OperationId::from("19b16cf8-a1ad-4948-aaac-b6f4eb7fca52");
assert_eq!(
operation_id,
OperationId::Uuid(Uuid::parse_str("19b16cf8-a1ad-4948-aaac-b6f4eb7fca52").unwrap())
);
Ok(())
}
#[nativelink_test]
async fn parse_empty_failure() -> Result<(), Error> {
{
let operation_id = OperationId::from("");
assert_eq!(operation_id, OperationId::String(String::new()));
}
{
let operation_id = OperationId::from("foobar");
assert_eq!(operation_id, OperationId::String("foobar".to_string()));
}
Ok(())
}