feat: add test def and test token
This commit is contained in:
		
							parent
							
								
									80a9b7b36a
								
							
						
					
					
						commit
						a65b4aa471
					
				|  | @ -138,6 +138,8 @@ pub enum Definition<T, Expr, ConstantRecordTag, PackageName> { | |||
|     Use(Use<PackageName>), | ||||
| 
 | ||||
|     ModuleConstant(ModuleConstant<T, ConstantRecordTag>), | ||||
| 
 | ||||
|     Test(Function<T, Expr>), | ||||
| } | ||||
| 
 | ||||
| impl<A, B, C, E> Definition<A, B, C, E> { | ||||
|  | @ -147,7 +149,8 @@ impl<A, B, C, E> Definition<A, B, C, E> { | |||
|             | Definition::Use(Use { location, .. }) | ||||
|             | Definition::TypeAlias(TypeAlias { location, .. }) | ||||
|             | Definition::DataType(DataType { location, .. }) | ||||
|             | Definition::ModuleConstant(ModuleConstant { location, .. }) => *location, | ||||
|             | Definition::ModuleConstant(ModuleConstant { location, .. }) | ||||
|             | Definition::Test(Function { location, .. }) => *location, | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | @ -157,7 +160,8 @@ impl<A, B, C, E> Definition<A, B, C, E> { | |||
|             Definition::Fn(Function { doc, .. }) | ||||
|             | Definition::TypeAlias(TypeAlias { doc, .. }) | ||||
|             | Definition::DataType(DataType { doc, .. }) | ||||
|             | Definition::ModuleConstant(ModuleConstant { doc, .. }) => { | ||||
|             | Definition::ModuleConstant(ModuleConstant { doc, .. }) | ||||
|             | Definition::Test(Function { doc, .. }) => { | ||||
|                 let _ = std::mem::replace(doc, Some(new_doc)); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -67,6 +67,7 @@ pub fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = ParseError> { | |||
|         "check" => Token::Assert, | ||||
|         "const" => Token::Const, | ||||
|         "fn" => Token::Fn, | ||||
|         "test" => Token::Test, | ||||
|         "if" => Token::If, | ||||
|         "else" => Token::Else, | ||||
|         "is" => Token::Is, | ||||
|  |  | |||
|  | @ -68,6 +68,7 @@ pub enum Token { | |||
|     Opaque, | ||||
|     Pub, | ||||
|     Use, | ||||
|     Test, | ||||
|     Todo, | ||||
|     Trace, | ||||
|     Type, | ||||
|  | @ -145,6 +146,7 @@ impl fmt::Display for Token { | |||
|             Token::Todo => "todo", | ||||
|             Token::Trace => "try", | ||||
|             Token::Type => "type", | ||||
|             Token::Test => "test", | ||||
|         }; | ||||
|         write!(f, "\"{}\"", s) | ||||
|     } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 rvcas
						rvcas