formula.vim 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. " vim: fdm=indent
  2. source t/config/options.vim
  3. describe 'Formulas'
  4. describe 'Add Formula'
  5. before
  6. new
  7. read t/fixtures/formula/sample.txt
  8. end
  9. it 'should add a formula successfully'
  10. call cursor(6, 15)
  11. call tablemode#spreadsheet#formula#Add("Sum(1:3)")
  12. Expect tablemode#spreadsheet#cell#GetCell() == '125.0'
  13. call cursor(8, 15)
  14. Expect getline('.') == '/* tmf: $4,2=Sum(1:3) */'
  15. call cursor(7, 15)
  16. call tablemode#spreadsheet#formula#Add("Sum(1:-1)")
  17. Expect tablemode#spreadsheet#cell#GetCell() == '250.0'
  18. call cursor(8, 15)
  19. Expect getline('.') == '/* tmf: $4,2=Sum(1:3); $5,2=Sum(1:-1) */'
  20. end
  21. end
  22. describe 'Evaluate Formula'
  23. before
  24. new
  25. read t/fixtures/formula/formula.txt
  26. end
  27. it 'should evaluate the formula successfull'
  28. call cursor(6, 15)
  29. call tablemode#spreadsheet#formula#EvaluateFormulaLine()
  30. Expect &modified == 1
  31. Expect tablemode#spreadsheet#cell#GetCell() == '125.0'
  32. end
  33. end
  34. end