Skip to content

Commit

Permalink
Merge pull request #349 from Pivot-Studio/griffin/chore/add-test-case…
Browse files Browse the repository at this point in the history
…s-for-comments

chore: add some test cases for comment parser
  • Loading branch information
Chronostasys authored Nov 23, 2023
2 parents c44f948 + fa64c4c commit feb55e0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
.PHONY: devlinux devmac vm install fmt test clean bench
devlinux:
@echo "export KAGARI_LIB_ROOT=$$(pwd)/planglib">>~/.bashrc
@echo "export PL_ROOT=$$(pwd)/target/release/">>~/.bashrc
@echo "export KAGARI_LIB_ROOT=$$(pwd)/planglib" >> ~/.bashrc
@echo "export PL_ROOT=$$(pwd)/target/release/" >> ~/.bashrc
@source ~/.bashrc
@echo "环境变量已加入~/.bashrc,请重启终端和vsc应用更改"

devmac:
@echo "export KAGARI_LIB_ROOT=$$(pwd)/planglib">>~/.bash_profile
@echo "export PL_ROOT=$$(pwd)/target/release/">>~/.bash_profile
@echo "环境变量已加入~/.bash_profile,请重启终端和vsc应用更改"
@echo "export KAGARI_LIB_ROOT=$$(pwd)/planglib" >> ~/.bash_profile
@echo "export PL_ROOT=$$(pwd)/target/release/" >> ~/.bash_profile
@source ~/.bash_profile
@echo "环境变量已加入~/.bashrc,请重启终端和vsc应用更改"

vm:
@cd vm && cargo build --release
Expand Down
2 changes: 1 addition & 1 deletion book/src/CONTRIBUTING-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

如果可能的话,希望您能提供:

- 如歌是在使用的时候遇到的bug,最好有一小段代码或者一个指向 [gist][is1] 的链接,其中包含能复现问题的代码。
- 如果是在使用的时候遇到的bug,最好有一小段代码或者一个指向 [gist][is1] 的链接,其中包含能复现问题的代码。
- 完整的 backtrace, 如果是进程崩溃相关的问题。
- 一个示例项目,如果是编译相关的问题。

Expand Down
10 changes: 6 additions & 4 deletions book/src/dev-prepare.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,18 @@ make test

### No suitable version of LLVM was found system-wide or pointed

需要设置llvm环境变量,如果你使用的是ubuntu,可以在`~/.bashrc`中加入如下代码然后执行.
需要设置llvm环境变量,如果你使用的是ubuntu,可以执行如下脚本.

```bash
export LLVM_SYS_160_PREFIX=/usr/lib/llvm-16
echo "export LLVM_SYS_160_PREFIX=/usr/lib/llvm-16" >> ~/.bashrc
source ~/.bashrc
```

如果是macOS通过`brew install llvm@16`安装,则需要设置环境变量:

```bash
export LLVM_SYS_160_PREFIX=$(brew --prefix llvm@16)
echo "export LLVM_SYS_160_PREFIX=$(brew --prefix llvm@16)" >> ~/.bashrc
source ~/.bashrc
```

### Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Expand All @@ -89,5 +90,6 @@ sudo apt install zlib1g-dev
在Mac上出现时,可能是缺少`LIBRARY_PATH`环境变量

```bash
export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib
echo "export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib" >> ~/.bashrc
source ~/.bashrc
```
8 changes: 8 additions & 0 deletions src/nomparser/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ use nom_locate::LocatedSpan;
use super::*;

#[test_parser("//123")]
#[test_parser("//123\t")]
#[test_parser("//123 \u{1234}")]
#[test_parser("/// 123\n")]
#[test_parser("//12\r //3")]
#[test_parser("//12\r \\//3")]
#[test_parser_error("//12\r\n /3")]
#[test_parser("/// 123\r 456")]
#[test_parser_error("/// 12\n 3 ///")]
#[test_parser_error("/ / 123\n")]
#[test_parser_error("//123 \n \n ///")]
pub fn comment(input: Span) -> IResult<Span, Box<NodeEnum>> {
map_res(
pair(
Expand Down

0 comments on commit feb55e0

Please sign in to comment.