Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
Signed-off-by: shruti2522 <shruti.apc01@gmail.com>
  • Loading branch information
shruti2522 committed May 19, 2024
1 parent cd4a530 commit e6e9281
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions kclvm/tools/src/LSP/src/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ mod tests {
lsp_types::HoverContents::Array(vec) => {
assert_eq!(vec.len(), 2);
if let MarkedString::String(s) = vec[0].clone() {
assert_eq!(s, "```kcl\nfn encode(```kcl\nvalue: str\n```, ```kcl\nencoding: str\n```) -> ```kcl\nstr\n```");
assert_eq!(s, "```kcl\nfn encode\n```(```kcl\nvalue: str\n```, ```kcl\nencoding: str\n```)```kcl\n -> str\n```");
}
if let MarkedString::String(s) = vec[1].clone() {
assert_eq!(
Expand All @@ -389,10 +389,10 @@ mod tests {
lsp_types::HoverContents::Array(vec) => {
assert_eq!(vec.len(), 3);
if let MarkedString::String(s) = vec[0].clone() {
assert_eq!(s, "```kcl\nstr\n```\n\n");
assert_eq!(s, "```kcl\nstr\n\n\n```");
}
if let MarkedString::String(s) = vec[1].clone() {
assert_eq!(s, "```kcl\nfn count(```kcl\nsub: str\n```, ```kcl\nstart: int\n```, ```kcl\nend: int\n```) -> ```kcl\nint\n```");
assert_eq!(s, "```kcl\nfn count\n```(```kcl\nsub: str\n```, ```kcl\nstart: int\n```, ```kcl\nend: int\n```)```kcl\n -> int\n```");
}
if let MarkedString::String(s) = vec[2].clone() {
assert_eq!(s, "Return the number of non-overlapping occurrences of substring sub in the range [start, end]. Optional arguments start and end are interpreted as in slice notation.");
Expand All @@ -412,7 +412,7 @@ mod tests {
lsp_types::HoverContents::Array(vec) => {
assert_eq!(vec.len(), 2);
if let MarkedString::String(s) = vec[0].clone() {
assert_eq!(s, "```kcl\nfn print() -> ```kcl\nNoneType\n```");
assert_eq!(s, "```kcl\nfn print\n```()```kcl\n -> NoneType\n```");
}
if let MarkedString::String(s) = vec[1].clone() {
assert_eq!(s, "Prints the values to a stream, or to the system stdout by default.\n\nOptional keyword arguments:\n\nsep: string inserted between values, default a space.\n\nend: string appended after the last value, default a newline.");
Expand Down Expand Up @@ -476,10 +476,10 @@ mod tests {
lsp_types::HoverContents::Array(vec) => {
assert_eq!(vec.len(), 3);
if let MarkedString::String(s) = vec[0].clone() {
assert_eq!(s, "```kcl\nstr\n```\n\n");
assert_eq!(s, "```kcl\nstr\n\n\n```");
}
if let MarkedString::String(s) = vec[1].clone() {
assert_eq!(s, "```kcl\nfn capitalize() -> ```kcl\nstr\n```");
assert_eq!(s, "```kcl\nfn capitalize\n```()```kcl\n -> str\n```");
}
if let MarkedString::String(s) = vec[2].clone() {
assert_eq!(s, "Return a copy of the string with its first character capitalized and the rest lowercased.");
Expand Down Expand Up @@ -567,7 +567,7 @@ mod tests {
};
let got = hover(&program, &pos, &gs).unwrap();
let expect_content = vec![MarkedString::String(
"```kcl\nfn deprecated(```kcl\nversion: str\n```, ```kcl\nreason: str\n```, ```kcl\nstrict: bool\n```) -> ```kcl\nany\n```".to_string(),
"```kcl\nfn deprecated\n```(```kcl\nversion: str\n```, ```kcl\nreason: str\n```, ```kcl\nstrict: bool\n```)```kcl\n -> any\n```".to_string(),
), MarkedString::String(
"This decorator is used to get the deprecation message according to the wrapped key-value pair.".to_string(),
)];
Expand Down

0 comments on commit e6e9281

Please sign in to comment.