Code Cleanup

- Eliminated 'Sensor' code and tests, which would only have been used
  for the interactive version.
- Eliminated obsolete ui code.
This commit is contained in:
Paul Beckingham 2011-03-27 12:36:25 -04:00
parent c502f0216a
commit 84fb46f233
29 changed files with 10 additions and 2919 deletions

View file

@ -6,8 +6,7 @@ include_directories (${CMAKE_SOURCE_DIR}/src
set (test_SRCS date.t t.t tdb.t duration.t t.benchmark.t text.t autocomplete.t
seq.t record.t att.t subst.t nibbler.t filt.t cmd.t config.t
util.t color.t list.t path.t file.t grid.t directory.t rx.t
taskmod.t lisp.t rectangle.t sensor.t tree.t tree2.t uri.t
json.t)
taskmod.t lisp.t rectangle.t tree.t tree2.t uri.t json.t)
add_custom_target (test ./run_all DEPENDS ${test_SRCS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test)

View file

@ -1,84 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2010 - 2011, Paul Beckingham, Federico Hernandez, Federico Hernandez.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA
// 02110-1301
// USA
//
////////////////////////////////////////////////////////////////////////////////
#include <fstream>
#include <unistd.h>
#include "Context.h"
#include "Sensor.h"
#include "test.h"
Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest ut (7);
// Make sure there is no file.
unlink ("./sensor.foo");
// Create sensor for missing file.
Sensor s;
s.fileModification ("./sensor.foo");
ut.ok (!s.changed (), "file not yet changed");
// Create the file.
std::ofstream one ("./sensor.foo", std::ios_base::out | std::ios_base::app);
if (one.good ())
{
one << "touch\n";
one.close ();
}
// Should register the change, so reset.
ut.ok (s.changed (), "file changed");
s.reset ();
ut.ok (!s.changed (), "file not yet changed");
// Wait a little, then modify the file.
ut.diag ("sleep 2");
sleep (2);
std::ofstream two ("./sensor.foo", std::ios_base::out | std::ios_base::app);
if (two.good ())
{
two << "touch\n";
two.close ();
}
ut.ok (s.changed (), "file changed");
ut.ok (s.changed (), "file still changed");
s.reset ();
ut.ok (!s.changed (), "file not changed again");
unlink ("./sensor.foo");
ut.ok (s.changed (), "file changed");
return 0;
}
////////////////////////////////////////////////////////////////////////////////