jest 的文档似乎都假设我们熟悉整个yarn/npm/node 生态系统(我是一个java 人,所以不太熟悉)。
pom.xml我在运行 webpack 时有以下内容。我只是不知道如何扩展它,以便 mvn test 将在玩笑中运行单元测试
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<installDirectory>target</installDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v10.11.0</nodeVersion>
<npmVersion>6.4.1</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>webpack build</id>
<goals>
<goal>webpack</goal>
</goals>
</execution>
<execution>
<id>test</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>test</phase>
<configuration>
<arguments>test</arguments>
<environmentVariables>
<CI>true</CI>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 问题的最小工作示例。阅读这篇关于扩展特性的文章,我尝试实现我自己的。
use std::io::{Read, Cursor};
use std::io;
pub trait KRead {
fn read1(&mut self) -> io::Result<i32>;
}
impl KRead for Read {
fn read1(&mut self) -> io::Result<i32> {
let mut buf = [0u8];
self.read_exact(&mut buf)?;
Ok(buf[0] as i32)
}
}
fn main() -> io::Result<()> {
let input_data = [47u8, 56u8];
let mut input_buffer = Cursor::new(input_data);
assert_eq!(47, input_buffer.read1()?);
assert_eq!(56, input_buffer.read1()?);
Ok(())
}
Run Code Online (Sandbox Code Playgroud)
但编译失败
No method named `read1` found for struct `std::io::Cursor<[u8; 2]>` in the current scope
No method …Run Code Online (Sandbox Code Playgroud) 我一直对技术标准 51 的附件 C和附件 29关于 Unicode 文本分割以及Unicode 字形断裂测试数据文件感到困惑,附件 29 中簇的定义似乎没有涵盖序列tag_base tag_spec + tag_end意味着构建为表情符号标签序列的字符将被附件 29 算法视为 7 个字素,而不是人们所期望的单个字素。
我知道实现所呈现的序列具有灵活性,但正确的行为似乎是将语法上有效的表情符号标签序列的所有实例视为单个字素以进行聚类分析,而不是分解从标签构建的字符序列成多个字素。
编辑添加: