microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.8.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

compiler/qsc_doc_gen/src/generate_docs/tests.rs

54lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#![allow(clippy::needless_raw_string_hashes)]
5
6use super::generate_docs;
7use expect_test::expect;
8
9#[test]
10fn docs_generation() {
11 let files = generate_docs(None, None, None);
12 let (_, metadata, contents) = files
13 .iter()
14 .find(|(file_name, _, _)| &**file_name == "Microsoft.Quantum.Core/Length.md")
15 .expect("Could not file doc file for Length");
16 let full_contents = format!("{metadata}\n\n{contents}");
17
18 expect![[r#"
19 ---
20 uid: Qdk.Microsoft.Quantum.Core.Length
21 title: Length function
22 ms.date: {TIMESTAMP}
23 ms.topic: managed-reference
24 qsharp.kind: function
25 qsharp.namespace: Microsoft.Quantum.Core
26 qsharp.name: Length
27 qsharp.summary: "Returns the number of elements in the input array `a`."
28 ---
29
30 # Length function
31
32 Fully qualified name: Microsoft.Quantum.Core.Length
33
34 ```qsharp
35 function Length<'T>(a : 'T[]) : Int
36 ```
37
38 ## Summary
39 Returns the number of elements in the input array `a`.
40
41 ## Input
42 ### a
43 Input array.
44
45 ## Output
46 The total number of elements in the input array `a`.
47
48 ## Example
49 ```qsharp
50 Message($"{ Length([0, 0, 0]) }"); // Prints 3
51 ```
52 "#]]
53 .assert_eq(full_contents.as_str());
54}
55