|
|
@@ -1,10 +1,10 @@
|
|
|
use crate::{first_error, no_errors};
|
|
|
-use solang::file_cache::FileCache;
|
|
|
+use solang::file_resolver::FileResolver;
|
|
|
use solang::Target;
|
|
|
|
|
|
#[test]
|
|
|
fn enum_import() {
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -30,7 +30,7 @@ fn enum_import() {
|
|
|
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -56,7 +56,7 @@ fn enum_import() {
|
|
|
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -82,7 +82,7 @@ fn enum_import() {
|
|
|
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -108,7 +108,7 @@ fn enum_import() {
|
|
|
);
|
|
|
|
|
|
// from has special handling to avoid making it a keyword
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -125,7 +125,7 @@ fn enum_import() {
|
|
|
"‘frum’ found where ‘from’ expected"
|
|
|
);
|
|
|
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -145,7 +145,7 @@ fn enum_import() {
|
|
|
|
|
|
#[test]
|
|
|
fn struct_import() {
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -171,7 +171,7 @@ fn struct_import() {
|
|
|
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -200,7 +200,7 @@ fn struct_import() {
|
|
|
|
|
|
#[test]
|
|
|
fn contract_import() {
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -235,7 +235,7 @@ fn contract_import() {
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
// lets try a importing an import
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -278,7 +278,7 @@ fn contract_import() {
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
// now let's rename an import in a chain
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -323,7 +323,7 @@ fn contract_import() {
|
|
|
|
|
|
#[test]
|
|
|
fn circular_import() {
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"self.sol",
|
|
|
@@ -343,7 +343,7 @@ fn circular_import() {
|
|
|
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -388,7 +388,7 @@ fn circular_import() {
|
|
|
#[test]
|
|
|
fn import_symbol() {
|
|
|
// import struct via import symbol
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -419,7 +419,7 @@ fn import_symbol() {
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
// import contract via import symbol
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -454,7 +454,7 @@ fn import_symbol() {
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
// import enum in contract via import symbol
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -489,7 +489,7 @@ fn import_symbol() {
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
// import struct in contract via import symbol chain
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -537,7 +537,7 @@ fn import_symbol() {
|
|
|
#[test]
|
|
|
fn enum_import_chain() {
|
|
|
// import struct in contract via import symbol chain
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -584,7 +584,7 @@ fn enum_import_chain() {
|
|
|
no_errors(ns.diagnostics);
|
|
|
|
|
|
// now with error
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|
|
|
@@ -637,7 +637,7 @@ fn enum_import_chain() {
|
|
|
#[test]
|
|
|
fn import_base_dir() {
|
|
|
// if a imports x/b.sol then when x/b.sol imports, it should use x/ as a base
|
|
|
- let mut cache = FileCache::new();
|
|
|
+ let mut cache = FileResolver::new();
|
|
|
|
|
|
cache.set_file_contents(
|
|
|
"a.sol",
|