microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.23.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

source/language_service/src/completion/tests/class_completions.rs

91lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#![allow(clippy::too_many_lines)]
5
6use super::check_single_file;
7use expect_test::expect;
8
9// the `Iterable` class should not be in completions until we support it
10#[test]
11fn iterable_not_included_in_completions() {
12 check_single_file(
13 r"namespace Test {
14 operation Test<'T: ↘
15 }",
16 &["Iterable"],
17 &expect![[r#"
18 not found:
19 "Iterable"
20 "#]],
21 );
22}
23
24// the `Num` class should not be in completions since it was dropped
25#[test]
26fn num_not_included_in_completions() {
27 check_single_file(
28 r"namespace Test {
29 operation Test<'T: ↘
30 }",
31 &["Num"],
32 &expect![[r#"
33 not found:
34 "Num"
35 "#]],
36 );
37}
38
39#[test]
40fn all_prim_classes_in_completions() {
41 check_single_file(
42 r"namespace Test {
43 operation Test<'T: ↘
44 }",
45 &[
46 "Eq", "Add", "Exp", "Integral", "Mod", "Mul", "Sub", "Div", "Signed", "Ord", "Show",
47 ],
48 &expect![[r#"
49 found, sorted:
50 "Add" (Class)
51 "Div" (Class)
52 "Eq" (Class)
53 "Exp" (Class)
54 detail: "Exp['Power]"
55 "Integral" (Class)
56 "Mod" (Class)
57 "Mul" (Class)
58 "Ord" (Class)
59 "Show" (Class)
60 "Signed" (Class)
61 "Sub" (Class)
62 "#]],
63 );
64}
65
66#[test]
67fn classes_appear_after_plus_too() {
68 check_single_file(
69 r"namespace Test {
70 operation Test<'T: Add + ↘
71 }",
72 &[
73 "Eq", "Add", "Exp", "Integral", "Mod", "Mul", "Sub", "Div", "Signed", "Ord", "Show",
74 ],
75 &expect![[r#"
76 found, sorted:
77 "Add" (Class)
78 "Div" (Class)
79 "Eq" (Class)
80 "Exp" (Class)
81 detail: "Exp['Power]"
82 "Integral" (Class)
83 "Mod" (Class)
84 "Mul" (Class)
85 "Ord" (Class)
86 "Show" (Class)
87 "Signed" (Class)
88 "Sub" (Class)
89 "#]],
90 );
91}
92