mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:07:44 +00:00
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
This commit is contained in:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -73,7 +73,7 @@ void Cell::set_type(const StringView& name)
|
|||
return set_type(cell_type);
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void Cell::set_type_metadata(CellTypeMetadata&& metadata)
|
||||
|
|
|
@ -56,7 +56,7 @@ Vector<StringView> CellType::names()
|
|||
CellType::CellType(const StringView& name)
|
||||
: m_name(name)
|
||||
{
|
||||
ASSERT(!s_cell_types.contains(name));
|
||||
VERIFY(!s_cell_types.contains(name));
|
||||
s_cell_types.set(name, this);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Spreadsheet {
|
|||
CellTypeDialog::CellTypeDialog(const Vector<Position>& positions, Sheet& sheet, GUI::Window* parent)
|
||||
: GUI::Dialog(parent)
|
||||
{
|
||||
ASSERT(!positions.is_empty());
|
||||
VERIFY(!positions.is_empty());
|
||||
|
||||
StringBuilder builder;
|
||||
|
||||
|
@ -239,7 +239,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
|
|||
m_horizontal_alignment = HorizontalAlignment::Right;
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
|
|||
m_vertical_alignment = VerticalAlignment::Bottom;
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ ConditionsView::ConditionsView()
|
|||
|
||||
void ConditionsView::set_formats(Vector<ConditionalFormat>* formats)
|
||||
{
|
||||
ASSERT(!m_formats);
|
||||
VERIFY(!m_formats);
|
||||
|
||||
m_formats = formats;
|
||||
|
||||
|
@ -454,7 +454,7 @@ void ConditionsView::set_formats(Vector<ConditionalFormat>* formats)
|
|||
|
||||
void ConditionsView::add_format()
|
||||
{
|
||||
ASSERT(m_formats);
|
||||
VERIFY(m_formats);
|
||||
|
||||
m_formats->empend();
|
||||
auto& last = m_formats->last();
|
||||
|
@ -466,7 +466,7 @@ void ConditionsView::add_format()
|
|||
|
||||
void ConditionsView::remove_top()
|
||||
{
|
||||
ASSERT(m_formats);
|
||||
VERIFY(m_formats);
|
||||
|
||||
if (m_formats->is_empty())
|
||||
return;
|
||||
|
|
|
@ -100,7 +100,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
|
|||
|
||||
m_webview = splitter.add<Web::OutOfProcessWebView>();
|
||||
m_webview->on_link_click = [this](auto& url, auto&, auto&&) {
|
||||
ASSERT(url.protocol() == "spreadsheet");
|
||||
VERIFY(url.protocol() == "spreadsheet");
|
||||
if (url.host() == "example") {
|
||||
auto entry = LexicalPath(url.path()).basename();
|
||||
auto doc_option = m_docs.get(entry);
|
||||
|
@ -159,19 +159,19 @@ HelpWindow::HelpWindow(GUI::Window* parent)
|
|||
String HelpWindow::render(const StringView& key)
|
||||
{
|
||||
auto doc_option = m_docs.get(key);
|
||||
ASSERT(doc_option.is_object());
|
||||
VERIFY(doc_option.is_object());
|
||||
|
||||
auto& doc = doc_option.as_object();
|
||||
|
||||
auto name = doc.get("name").to_string();
|
||||
auto argc = doc.get("argc").to_u32(0);
|
||||
auto argnames_value = doc.get("argnames");
|
||||
ASSERT(argnames_value.is_array());
|
||||
VERIFY(argnames_value.is_array());
|
||||
auto& argnames = argnames_value.as_array();
|
||||
|
||||
auto docstring = doc.get("doc").to_string();
|
||||
auto examples_value = doc.get_or("examples", JsonObject {});
|
||||
ASSERT(examples_value.is_object());
|
||||
VERIFY(examples_value.is_object());
|
||||
auto& examples = examples_value.as_object();
|
||||
|
||||
StringBuilder markdown_builder;
|
||||
|
|
|
@ -243,9 +243,9 @@ XSV::Field XSV::read_one_unquoted_field()
|
|||
|
||||
StringView XSV::Row::operator[](StringView name) const
|
||||
{
|
||||
ASSERT(!m_xsv.m_names.is_empty());
|
||||
VERIFY(!m_xsv.m_names.is_empty());
|
||||
auto it = m_xsv.m_names.find_if([&](const auto& entry) { return name == entry; });
|
||||
ASSERT(!it.is_end());
|
||||
VERIFY(!it.is_end());
|
||||
|
||||
return (*this)[it.index()];
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ const XSV::Row XSV::operator[](size_t index) const
|
|||
|
||||
XSV::Row XSV::operator[](size_t index)
|
||||
{
|
||||
ASSERT(m_rows.size() > index);
|
||||
VERIFY(m_rows.size() > index);
|
||||
return Row { *this, index };
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
ENUMERATE_READ_ERRORS();
|
||||
#undef E
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
size_t size() const { return m_rows.size(); }
|
||||
|
|
|
@ -103,7 +103,7 @@ static String convert_to_string(size_t value, unsigned base = 26, StringView map
|
|||
if (map.is_null())
|
||||
map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
ASSERT(base >= 2 && base <= map.length());
|
||||
VERIFY(base >= 2 && base <= map.length());
|
||||
|
||||
// The '8 bits per byte' assumption may need to go?
|
||||
Array<char, round_up_to_power_of_two(sizeof(size_t) * 8 + 1, 2)> buffer;
|
||||
|
@ -130,7 +130,7 @@ static size_t convert_from_string(StringView str, unsigned base = 26, StringView
|
|||
if (map.is_null())
|
||||
map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
ASSERT(base >= 2 && base <= map.length());
|
||||
VERIFY(base >= 2 && base <= map.length());
|
||||
|
||||
size_t value = 0;
|
||||
for (size_t i = str.length(); i > 0; --i) {
|
||||
|
@ -295,7 +295,7 @@ Optional<Position> Sheet::position_from_url(const URL& url) const
|
|||
}
|
||||
|
||||
// FIXME: Figure out a way to do this cross-process.
|
||||
ASSERT(url.path() == String::formatted("/{}", getpid()));
|
||||
VERIFY(url.path() == String::formatted("/{}", getpid()));
|
||||
|
||||
return parse_cell_name(url.fragment());
|
||||
}
|
||||
|
|
|
@ -106,12 +106,12 @@ public:
|
|||
for (size_t i = column_count(); i < index; ++i)
|
||||
add_column();
|
||||
|
||||
ASSERT(column_count() > index);
|
||||
VERIFY(column_count() > index);
|
||||
return m_columns[index];
|
||||
}
|
||||
const String& column(size_t index) const
|
||||
{
|
||||
ASSERT(column_count() > index);
|
||||
VERIFY(column_count() > index);
|
||||
return m_columns[index];
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ RefPtr<Core::MimeData> SheetModel::mime_data(const GUI::ModelSelection& selectio
|
|||
first = false;
|
||||
});
|
||||
|
||||
ASSERT(cursor);
|
||||
VERIFY(cursor);
|
||||
|
||||
Position cursor_position { m_sheet->column(cursor->column()), (size_t)cursor->row() };
|
||||
auto new_data = String::formatted("{}\n{}",
|
||||
|
|
|
@ -284,7 +284,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet)
|
|||
|
||||
if (event.mime_data().has_text()) {
|
||||
auto* target_cell = m_sheet->at({ m_sheet->column(index.column()), (size_t)index.row() });
|
||||
ASSERT(target_cell);
|
||||
VERIFY(target_cell);
|
||||
|
||||
target_cell->set_data(event.text());
|
||||
return;
|
||||
|
|
|
@ -96,7 +96,7 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s
|
|||
|
||||
m_tab_context_menu = GUI::Menu::construct();
|
||||
auto rename_action = GUI::Action::create("Rename...", [this](auto&) {
|
||||
ASSERT(m_tab_context_menu_sheet_view);
|
||||
VERIFY(m_tab_context_menu_sheet_view);
|
||||
|
||||
auto& sheet = m_tab_context_menu_sheet_view->sheet();
|
||||
String new_name;
|
||||
|
@ -321,7 +321,7 @@ void SpreadsheetWidget::add_sheet()
|
|||
|
||||
void SpreadsheetWidget::add_sheet(NonnullRefPtr<Sheet>&& sheet)
|
||||
{
|
||||
ASSERT(m_workbook == &sheet->workbook());
|
||||
VERIFY(m_workbook == &sheet->workbook());
|
||||
|
||||
NonnullRefPtrVector<Sheet> new_sheets;
|
||||
new_sheets.append(move(sheet));
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
ENUMERATE_WRITE_ERRORS();
|
||||
#undef E
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -165,7 +165,7 @@ int main(int argc, char* argv[])
|
|||
/// - currently selected cell
|
||||
/// - selected cell+
|
||||
auto& cells = spreadsheet_widget.current_worksheet().selected_cells();
|
||||
ASSERT(!cells.is_empty());
|
||||
VERIFY(!cells.is_empty());
|
||||
StringBuilder text_builder, url_builder;
|
||||
bool first = true;
|
||||
auto cursor = spreadsheet_widget.current_selection_cursor();
|
||||
|
@ -201,7 +201,7 @@ int main(int argc, char* argv[])
|
|||
ScopeGuard update_after_paste { [&] { spreadsheet_widget.update(); } };
|
||||
|
||||
auto& cells = spreadsheet_widget.current_worksheet().selected_cells();
|
||||
ASSERT(!cells.is_empty());
|
||||
VERIFY(!cells.is_empty());
|
||||
const auto& data = GUI::Clipboard::the().data_and_type();
|
||||
if (auto spreadsheet_data = data.metadata.get("text/x-spreadsheet-data"); spreadsheet_data.has_value()) {
|
||||
Vector<Spreadsheet::Position> source_positions, target_positions;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue