Repository: duckdb/duckdb
File: test/sqlite/sqllogic_test_runner.cpp (C++)

Code before:
				auto required_vector_size = std::stoi(token.parameters[1]);
				if (STANDARD_VECTOR_SIZE < required_vector_size) {
					// vector size is too low for this test: skip it
					return;
				}
			} else if (param == "skip_reload") {
				skip_reload = true;
			} else {
				auto result = ExtensionHelper::LoadExtension(*db, param);
				if (result == ExtensionLoadResult::LOADED_EXTENSION) {
					// add the extension to the list of loaded extensions
					extensions.insert(param);
				} else if (result == ExtensionLoadResult::EXTENSION_UNKNOWN) {
					parser.Fail("unknown extension type: %s", token.parameters[0]);
				} else if (result == ExtensionLoadResult::NOT_LOADED) {
					// extension known but not build: skip this test
					return;
				}
			}
		} else if (token.type == SQLLogicTokenType::SQLLOGIC_REQUIRE_ENV) {
			if (InLoop()) {
				parser.Fail("require-env cannot be called in a loop");
			}

			if (token.parameters.size() != 1 && token.parameters.size() != 2) {
				parser.Fail("require-env requires 2 arguments: <env name> <env value>");
			}

			auto env_var = token.parameters[0];
			auto env_actual = std::getenv(env_var.c_str());
			if (env_actual == nullptr) {
				// Environment variable was not found, this test should not be run
				return;
			}

			if (token.parameters.size() == 2) {
				// Check that the value is the same as the expected value
				auto env_value = token.parameters[1];
				if (std::strcmp(env_actual, env_value.c_str()) != 0) {
					// It's not, check the test
					return;
				}
			}

			if (environment_variables.count(env_var)) {
				parser.Fail(StringUtil::Format("Environment variable '%s' has already been defined", env_var));
			}
			environment_variables[env_var] = env_actual;

		} else if (token.type == SQLLogicTokenType::SQLLOGIC_LOAD) {
			if (InLoop()) {

Review comment (suggestion):
error message should probably explain both usages with 1 or 2 params

Code after:
				auto required_vector_size = std::stoi(token.parameters[1]);
				if (STANDARD_VECTOR_SIZE < required_vector_size) {
					// vector size is too low for this test: skip it
					return;
				}
			} else if (param == "skip_reload") {
				skip_reload = true;
			} else {
				auto result = ExtensionHelper::LoadExtension(*db, param);
				if (result == ExtensionLoadResult::LOADED_EXTENSION) {
					// add the extension to the list of loaded extensions
					extensions.insert(param);
				} else if (result == ExtensionLoadResult::EXTENSION_UNKNOWN) {
					parser.Fail("unknown extension type: %s", token.parameters[0]);
				} else if (result == ExtensionLoadResult::NOT_LOADED) {
					// extension known but not build: skip this test
					return;
				}
			}
		} else if (token.type == SQLLogicTokenType::SQLLOGIC_REQUIRE_ENV) {
			if (InLoop()) {
				parser.Fail("require-env cannot be called in a loop");
			}

			if (token.parameters.size() != 1 && token.parameters.size() != 2) {
				parser.Fail("require-env requires 1 argument: <env name> [optional: <expected env val>]");
			}

			auto env_var = token.parameters[0];
			auto env_actual = std::getenv(env_var.c_str());
			if (env_actual == nullptr) {
				// Environment variable was not found, this test should not be run
				return;
			}

			if (token.parameters.size() == 2) {
				// Check that the value is the same as the expected value
				auto env_value = token.parameters[1];
				if (std::strcmp(env_actual, env_value.c_str()) != 0) {
					// It's not, check the test
					return;
				}
			}

			if (environment_variables.count(env_var)) {
				parser.Fail(StringUtil::Format("Environment variable '%s' has already been defined", env_var));
			}
			environment_variables[env_var] = env_actual;

		} else if (token.type == SQLLogicTokenType::SQLLOGIC_LOAD) {
			if (InLoop()) {