microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
alex/telemmocks

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

52lines · modecode

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